Legacy Documentation. View NUnit 3 Documentation

SequentialAttribute (NUnit 2.5)

The SequentialAttribute is used on a test to specify that NUnit should generate test cases by selecting individual data items provided for the parameters of the test, without generating additional combinations.

Note: If parameter data is provided by multiple attributes, the order in which NUnit uses the data items is not guaranteed. However, it can be expected to remain constant for a given runtime and operating system. For best results with SequentialAttribute use only one data attribute on each parameter.

Example

The following test will be executed three times.

[Test, Sequential]
public void MyTest(
    [Values(1,2,3)] int x,
    [Values("A","B")] string s)
{
    ...
}

MyTest is called three times, as follows:

	MyTest(1, "A")
	MyTest(2, "B")
	MyTest(3, null)

See also...