views:

117

answers:

1

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].

+1  A: 

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.

GraemeF