简体   繁体   中英

MbUnit Parallelizable tests

I am looking at moving from NUnit to MbUnit for my unit testing framework as it has a couple of features that I like, one of them being the parallelizable attribute. If I mark tests with this attribute what happens

i, are all instance variables available only to their own thread or are they shared? ii, how many tests will execute at once? Is it dependant on the number of processors/cores?

Reason for asking the first question is that I have, as a test simply swapped the Nunit framework for th MbUnit framework, and in a particular test class sets of tests tend to fail when run in parallel and pass when run sequentially. These test use variables at the class level and then setup in the [SetUp].

The tests run on a single instance of your test fixture class, so the instance fields will be shared.

By default, the degree of parallelism equals the number of CPUs you have, or 2 at a minimum. You can use the DegreeOfParallelism attribute at the assembly level to override this.

See this blog post for details and some examples showing you how to use the various attributes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM