Parameterized tests
Write parameterized tests for data-driven testing.
Read time 1 minuteLast updated 11 days ago
Unity Test Framework supports parameterized tests, which can be useful for data-driven testing.
Regular NUnit tests support both the and attributes for parameterized tests. Unity tests only support
[TestCase][ValueSource]ValueSourceThe following example demonstrates use of with a Unity test:
ValueSourcestatic int[] values = new int[] { 1, 5, 6 };[UnityTest]public IEnumerator MyTestWithMultipleValues([ValueSource("values")] int value){ yield return null;}
Ignore based on parameters
You can selectively ignore tests based on the parameters supplied to the test method by using the ParameterizedIgnoreAttribute.