[v3.7.0.4]
I use IsolatedAttribute on fixture level to ensure my tests are all running inside same process (I use a login routine once during setup, which I don't want to redo more than once for all tests), but it seems every other run it runs the 2 tests in 2 different projects?
Repro:
Quote:
[TestFixture]
[Isolated]
internal class FooFixture
{
private static int _foo;
private static readonly object _fooLock=new object();
[SetUp]
public void FooFixtureSetUp()
{
lock (_fooLock)
{
if (_foo == 0)
_foo = 1;
else
Assert.Fail("Foo was 1.");
}
}
[Test]
public void Test1()
{
}[Test]
public void Test2()
{
}
}
Pin Test1 and Test2, hide all other tests, select "run all tests visible here" command. For me every other time there is 1 red and 1 green test (expected), and every other run 2 green (not expected). I notice that when I get the unexpected result NCrunch starts 2 TestHost test runners simultaneously.
Bonus question: Can I somehow keep this "isolated" test runner active, so I can reuse it if running tests with "run covering tests in existing project" ?
Thanks.
*Edit: This was probably wrong approach overall, I changed this to use a local cookies cache instead so it doesn't matter which test runner is used.