How to prevent step 8 from re-starting with nunit?

I ran tests in VS2013 using Resharper 8, which integrated with an external process and redirected its output. I am not looking for indications of what qualifies as a unit test, because I believe that a test runner is a better driver for any test than a console application.

This process was a database, so my SetUp and TearDown methods unsurprisingly made opposites from each other and will absolutely attack each other if they are allowed to work simultaneously.

They could not step on each other, because when two tests were run simultaneously, they were blocked.

The latest version of 7 Resharper did not have this problem.

The interaction with the unit test settings in Resharper> Parameters> Unit testing did not help.

+6
source share
2 answers

How to run NUnit test fixtures in series? - close to work.

On my test tool database (and I always run base.SetUp() at the beginning of the 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 allows NUnit to be too damn good and fast.

+6
source

The above answer from @ nik.shornikov will work, but in Resharper 2016.2 and later (and probably also in earlier versions) you can do this with the option without writing code. Please see my answer to Is there a way to * prevent * ReSharper from doing parallel parallel build tests for .

-1
source

Source: https://habr.com/ru/post/956770/


All Articles