Specifies that a test can be run in parallel with other parallelizable tests.

Namespace:  MbUnit.Framework
Assembly:  MbUnit (in MbUnit.dll) Version: 3.3.0.0 (3.3.392.0)

Syntax

C#
public class ParallelizableAttribute : TestDecoratorPatternAttribute
Visual Basic (Declaration)
Public Class ParallelizableAttribute _
	Inherits TestDecoratorPatternAttribute

Remarks

If this attribute is not specified, then the test will be run with Process-level isolation. That is, it will not run concurrently with any other test within the given process (notwithstanding any use of ThreadedRepeatAttribute or similar decorators).

Parallelizable tests are run in batches subject to the hierarchical structure of the tests, any explicit ordering specifications, and test dependencies.

If two tests must be run exclusively of one another but are otherwise parallelizable, then a simple expedient is to assign a different test order to each one. Later editions of the framework may introduce additional controls over test isolation, mutual exclusion, access to shared resources, and degree of paralleism.

To make all tests within a fixture parallelizable, apply this attribute to the fixture class with a scope of Descendants to only make the tests parallelizable or All to also make the fixture itself parallelizable. Likewise to make all tests in a test assembly parallelizable, apply this attribute to the test assembly with the scope set similarly.

Examples

This C# example shows a fixture with a few tests, two of which are parallelizable.

CopyC#
public class Fixture
{
    // may run in parallel with test 2
    [Parallelizable]
    public void Test1() { ... }
    // may run in parallel with test 1
    [Parallelizable]
    public void Test2() { ... }
    // will not run in parallel because it is not parallelizable
    public void Test3() { ... }
}

This C# example shows a fixture all of whose tests are parallelizable.

CopyC#
[Parallelizable(TestScope.Descendants)]
public class Fixture
{
    public void Test1() { ... }
    public void Test2() { ... }
    public void Test3() { ... }
}

This C# example shows a test assembly all of whose tests are parallelizable.

CopyC#
[assembly: Parallelizable(TestScope.All)]

Inheritance Hierarchy

System..::.Object
  System..::.Attribute
    Gallio.Framework.Pattern..::.PatternAttribute
      Gallio.Framework.Pattern..::.DecoratorPatternAttribute
        Gallio.Framework.Pattern..::.TestDecoratorPatternAttribute
          MbUnit.Framework..::.ParallelizableAttribute

See Also