开发者

How to generate NUnit fixtures programmatically?

开发者 https://www.devze.com 2022-12-27 14:29 出处:网络
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 TestS

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 the parameters, which means having N methods for every TestSomething() method. I could write another [Test] method looping on "someParam" values and calling TestSomething(), it means 2 methods for every test, and the test report is not as good as with individual TestSomethingWithXValue() met开发者_StackOverflow中文版hods.

So, is there any way to programmatically generate fixtures for every test methods and input values?


Check out Parameterized Tests With NUnit 2.5.

0

精彩评论

暂无评论...
验证码 换一张
取 消