I have an issue very similar to
https://forum.ncrunch.ne...le-Test-Generation.aspx but was seeing unexpected behavior so didn't want to hijack that thread.
We do have testcase Sources that are generated based on code. So I was going through the process of commenting out the tests that have TestCase sources to narrow down the issue.
When I started the message was
Quote:"NCrunch is unable to safely execute tests in this assembly because it contains unstable test generation. A previous discovery run over this assembly returned 1093 test cases, but when preparing NUnit to execute tests, there are now 1098 test cases. Usually this is caused by generating tests using TestCaseSource using random, inconsistent or otherwise unstable data."
Note: 1093 and 1098 so a difference of 5 in the discovery and execution.
I then commented out a test case source that had 10 cases but the message then switched to 1093 and 1088 (Meaning the previous number remained unchanged but the execution found the -10 tests that were removed).
This result confused me. Shouldn't both numbers reduced by 10 if the test generation for the removed case was stable (Which from what I can tell it is). It seems as if the discovery is not accounting for the removal of the 10 tests but the execution phase is.
Restarting the ncrunch engine did not change the outcome, however deleting the cache/workspace resulted in a successful run. Unfortunately a day later the issue came back, so it's not a random corruption.
I'm guessing I'm not understanding something about the problem. 1 thing I think might be interesting is that at least 1 of the test cases is dependent on a production enum so a change that doesn't affect the test assembly could alter the number of tests generated. (IE enum of 5 items in production code results in 5 * 2 tests) but that doesn't explain why commenting out the entire test case wouldn't adjust the count of the 1093 when re-running. I would also expect that to resolve itself re-initializing ncrunch until that enum was touched again invalidating the test discovery/assembly identity .
Any insight as to what I'm not understanding or how I should proceed?
Thanks, Hope everyone is well!
Mark