NCrunch Version 3.3.0.6
Visual Studio 2015
I've noticed that since the IL impact detection mode was added that it often fails to detect impacted code (and therefore fails to re-run impacted tests) when changes are made to an MSpec test. AFAIK it detects the changes correctly if the changes are made in the class under test instead.
I can send you the MCVE project I used to confirm this issue but it's also easy to recreate.
* Create a new project.
* Add Nuget dependency Machine.Specifications.Should.
* Enable NCrunch using "Run impacted tests automatically, other manually" mode.
* Add the following two classes (I have them in separate files, not sure if that's necessary):
Code:
public static class SystemUnderTest {
public static Int32 Add(Int32 first, Int32 second) {
return first + second;
}
}
[Subject(typeof(SystemUnderTest))]
public class when_adding {
Because of = () =>
_result = SystemUnderTest.Add(2, 2);
It should_add = () =>
_result.ShouldEqual(4);
static Int32 _result;
}
Then to reproduce the issue you just confirm that the test has run (it should pass) and then change the expected value to 5 and save the file. No rebuild is triggered and the test remains "Passed". If I manually trigger the test using "Run selected test in new task runner process" then suddenly it starts failing as expected.
I cannot reproduce the issue if the change is made in the SystemUnderTest class, e.g. changing the implementation to "return first + second + second;". The change is immediately detected and the test is failed as expected.
I also cannot reproduce this using "Run all tests automatically" mode. The change is immediately detected and the test is failed as expected.
Let me know if you need anything else to fix this issue.
I appreciate all your work on NCrunch, it's made my job a lot easier.