c# - NUnit: TestClass does not have any tests -


i’m trying test out nunit running few unit tests. however, noticed 1 thing. in nunit version 2.6.2 (the latest version), when imported test dll file, tests passed , failed in appropriate places , gave me correct warnings, messages , indicators.

however, in nunit version 2.4 rc1, same unit tests ignored. error message reads: “testclass not have tests” contain tests.

why this? i'm trying validate older version of software , need run unit tests on older version.

i used example run tests: http://www.codeproject.com/articles/178635/unit-testing-using-nunit

if had copied snippet code referenced url, must have this:

[testfixture] public class testclass {     [testcase]     public void addtest()     {         mathshelper helper = new mathshelper();         int result = helper.add(20, 10);         assert.areequal(30, result);     }      [testcase]     public void subtracttest()     {         mathshelper helper = new mathshelper();         int result = helper.subtract(20, 10);         assert.areequal(10, result);     } } 

but, if check documentation nunit version 2.4 (here), can see property method indicates test not [testcase]. use [test] instead.

[testfixture] public class testclass {     [test]     public void addtest()     {         mathshelper helper = new mathshelper();         int result = helper.add(20, 10);         assert.areequal(30, result);     }      [test]     public void subtracttest()     {         mathshelper helper = new mathshelper();         int result = helper.subtract(20, 10);         assert.areequal(10, result);     } } 

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -