How to create NUnit luminaires with software?

Let's say I have a test like:

void TestSomething(int someParam)
{
   // Test code
}

      

I would like to execute this test with a set of "someParam" values. I could write explicit [Test] fixtures calling TestSomething () with parameters, which means there are N methods for each TestSomething () method. I could write another [Test] method, loop over the "someParam" values ​​and call TestSomething (), this means there are two methods for each test, and the test report is not as good as using separate TestSomethingWiThanksValue () methods.

So, is there a way to programmatically generate fixtures for each test method and input values?

+2


a source to share


1 answer


Check out Parameterized Tests with NUnit 2.5 .



+3


a source







All Articles