Legacy Documentation. View NUnit 3 Documentation

ValuesAttribute (NUnit 2.5)

The ValuesAttribute is used to specify a set of values to be provided for an individual parameter of a parameterized test method. Since NUnit combines the data provided for each parameter into a set of test cases, data must be provided for all parameters if it is provided for any of them.

By default, NUnit creates test cases from all possible combinations of the datapoints provided on parameters - the combinatorial approach. This default may be modified by use of specific attributes on the test method itself.


The following test will be executed six times, as follows:

	MyTest(1, "A")
	MyTest(1, "B")
	MyTest(2, "A")
	MyTest(2, "B")
	MyTest(3, "A")
	MyTest(3, "B")
public void MyTest(
    [Values(1,2,3)] int x,
    [Values("A","B")] string s)

See also...