Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Detecting Impacted tests
Grendil
#1 Posted : Wednesday, May 24, 2017 9:20:20 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 3/18/2017(UTC)
Posts: 54
Location: United States of America

Thanks: 22 times
Was thanked: 11 time(s) in 10 post(s)
If I make a code change, say just one line, it seems NCrunch runs (at least) all the tests in the assembly that contains the impacted tests. Yet NCrunch knows through its code coverage analysis just which tests are directly impacted by my changed lines of code. Is there a way to have NCrunch prioritize rerun just those directly impacted tests? We currently have most of our unit tests in one assembly, and the experience is that many hundreds of tests are rerun (taking noticeable time) if I change just one line of code when really only a small handful of tests needed rerunning.

Am I missing a setting? I see several settings around Impact detection, but nothing seems to change the observed behavior.
Remco
#2 Posted : Wednesday, May 24, 2017 11:10:08 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Hi, thanks for posting.

If you choose the 'Run impacted tests only, others manually' engine mode from the NCrunch->Select Engine Mode menu option, NCrunch will do exactly this :)

You can also customise the engine modes if you have more specific needs, including the above one.
Grendil
#3 Posted : Thursday, May 25, 2017 6:06:18 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 3/18/2017(UTC)
Posts: 54
Location: United States of America

Thanks: 22 times
Was thanked: 11 time(s) in 10 post(s)
Remco;10457 wrote:
Hi, thanks for posting.

If you choose the 'Run impacted tests only, others manually' engine mode from the NCrunch->Select Engine Mode menu option, NCrunch will do exactly this :)

You can also customise the engine modes if you have more specific needs, including the above one.



Thanks as always Remco. I knew I had seen that at some point!
1 user thanked Grendil for this useful post.
Remco on 5/25/2017(UTC)
Grendil
#4 Posted : Monday, August 14, 2017 2:57:26 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 3/18/2017(UTC)
Posts: 54
Location: United States of America

Thanks: 22 times
Was thanked: 11 time(s) in 10 post(s)
My team is trying to understand the difference between "run automatically" and "run when impacted"? I've found hints in the docs, but as yet nothing clearly definitive. When would NCrunch see fit to run a test "automatically" different than when it was "impacted"? We'd like to make conservative use of our test running nodes, so we had thought to run tests only based on impacted code. Does this have negative implications or create risk that relevant tests aren't running?
Remco
#5 Posted : Monday, August 14, 2017 7:09:15 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Grendil;10977 wrote:
My team is trying to understand the difference between "run automatically" and "run when impacted"? I've found hints in the docs, but as yet nothing clearly definitive. When would NCrunch see fit to run a test "automatically" different than when it was "impacted"? We'd like to make conservative use of our test running nodes, so we had thought to run tests only based on impacted code. Does this have negative implications or create risk that relevant tests aren't running?


When set to run all tests, NCrunch will automatically run a test if it detects that the test project containing this test has a direct (or indirect) project dependency on any file in the solution that is changed. So if you change a text file in a project that sits at the bottom of your solution's dependency structure, ALL tests will be queued for execution, regardless of whether they have anything to do with the changed file. In most scenarios you'll likely find that all tests end up getting queued, unless your solution has very limited dependencies between certain projects it contains. In regards to the console tool, under this mode NCrunch will simply run every test in the solution.

When set to run only impacted tests, NCrunch will automatically run a test if it is determined by the engine to be potentially 'broken' by a code or resource file change. There are many rules that determine whether a test can be broken by a code change, but in most cases this is down to whether a test is physically covering the changed code. Because there are always edge cases that the impact detection cannot track (for example, reflection dependencies), under this mode there is a risk that a test may be broken by a code change but is not executed by NCrunch. No impact detection system is 100% accurate. For this reason, I only recommend using this mode if you still have something in your development process that still results in all tests being executed prior to code being released into production.
1 user thanked Remco for this useful post.
Grendil on 8/14/2017(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.040 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download