I was running tests in VS2013 with Resharper 8, which integrated with an external process and redirected its output. I'm not seeking guidance on what qualifies as a unit test, because I find the test runner to be a nicer driver for any test than a console app.
This process was a database and so my SetUp and TearDown methods unsurprisingly did the opposites of each other and would absolutely step on each other if allowed to run concurrently.
They did not get to step on each other, because whenever two tests were started by the running simultaneously, they would lock up.
Latest Version 7 of Resharper did not have this issue.
Tinkering with the unit test settings in Resharper > Options > Unit Testing did not help.
How to run NUnit test fixtures serially? -- is close to working.
On my test fixture base (and I always run base.SetUp()
at the beginning of derived SetUp), I added the following:
[SetUp]
protected virtual void SetUp()
{
FixtureHandle.Wait();
}
[TearDown]
protected virtual void TearDown()
{
FixtureHandle.Set();
}
FixtureHandle
is a ManualResetEvent
. This prevents NUnit from being too damn good and fast.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With