V3 Documentation
Search

NCrunch.Framework.SerialAttribute

NCrunch.Framework Attribute

Purpose

This attribute can be used to prevent all parallel execution of all other NCrunch tests while a specific test or fixture is being executed.

Tests and fixtures marked with this attribute will not be run concurrently with any other test in the solution.

This is a very broad way to prevent the concurrent execution of tests that do not support it.

This attribute can be applied at assembly level, in which case all tests within the assembly will be run without parallel execution.

Declaration In NCrunch.Framework.dll

namespace NCrunch.Framework
{
    public class SerialAttribute: Attribute
    {
    }
}

You can declare this in your own code if you want NCrunch to use it - or otherwise reference the attribute from NCrunch.Framework.dll.

Usage example

[NCrunch.Framework.Serial]
[Test]
public void MyTest()
{
	...

Recommendations

This attribute is a much less precise way to prevent concurrent execution than the ExclusivelyUsesAttribute.

You should only use this attribute in situations where the declaration of ExclusivelyUsesAttribute for conflicting tests is not feasible.

This attribute places tight contraints on the behaviour of the test pipeline, and any solution containing tests declared with it will experience higher test cycle times.