thedo;7424 wrote:Thanks for the reply!
In our case the tests are run serially and constrained to 1 thread, so the optimizations don't seem hugely valid. Is there a way to disable these optimizations via the options (I can see some optimizations can be disabled).
The behaviour of NCrunch in this situation isn't really tied to any specific optimization - but more to how a true continuous test runner needs to interact with the test framework.
Test frameworks can only a fixed list of tests end to end. This doesn't work well for continuous testing, as NCrunch needs to be able to update the list of tests dynamically while the tests execute. To work around this limitation, NCrunch separates the tests into batches (visible in the Processing Queue Window), and calls into the framework once for each batch. This works well for continuous behaviour, as when the source code is changed NCrunch is able to reprioritise the impacted tests and prompty execute them in a new order of priority.
This behaviour is essentially what enables true continuous testing. Without it, all we can do is run your entire suite of tests end-to-end without any real intelligence. It would be the same as scripting a test runner to just re-run the suite again and again in the background without any prioritisation. It's unfortunate that in order to enable this, we need to make multiple calls into the test framework.
In theory, it could be possible to modify the test framework so that the AssemblyInitialize method is only called once per session, but this would then create huge questions around how AssemblyCleanup should be implemented.
In summary, the current implementation is the 'least bad' of many bad options. I'm afraid there is no way to switch it off.