Hi, thanks for posting!
NCrunch won't ever run tests concurrently within the same process, but it will re-use processes between execution runs. Traditional serial test runners don't do this, so not all tests have been engineered to consider it. Broadly, there are two ways to do what you're asking:
1. Adorn the tests involved with the
IsolatedAttribute. Each test adorned with this attribute will be executed within a specially created process that is torn down as soon as the test has finished executing.
2. Set the
Test process memory limit configuration setting to '1'. This will force NCrunch to terminate each test process after the process has finished executing a batch of tests.
Unfortunately, both of the above options will have a serious impact on NCrunch's performance - especially if you have a large number of small tests. I'm afraid I don't know enough about the behaviour of TypeMock around how it mocks static members to know for certain whether or not the random failures are being caused by a TypeMock/NCrunch clash, or something else. I recommend trying to narrow down the problem to make sure it isn't an issue caused by leftover state being re-used accidentally between tests. It only takes 1 erroneous test to corrupt the state of a test process and cause some very bizarre behaviour downstream in the test pipeline, and often these sorts of problems don't become visible until the project is run under NCrunch. You may find the
troubleshooting guide helpful in further analysing this issue.
Cheers,
Remco