Sun, May 22 2005 10:46 PM Rob van der Meijden

Nunit backward compatibility

For all the developers who are writing there NUnit (2.2.2) tests remember this rule: 

            Never use the prefix ‘Test’ when creating private methods 

The previous version of NUnit requires that the test class inherit from a TestCase class and that the names of the methods running the tests begin with a "Test" prefix. These are no longer requirements because the NUnit developers have moved on to an attribute-based system. Nunit self however still interprets the test prefix, working fine for public methods, but for private methods (when you’re creating Nunit helpers for instance) you’ll get yellow colours and the following message (see also picture):

[Methodname] signature is not correct: It must be a public method

   

Replace or delete the Test prefix and Nunit will not try to test it again … 

 

Filed under:

# re: Nunit backward compatibility

Monday, May 23, 2005 7:42 AM by Rob van der Meijden

I always used (and still do) the [Test] attributes for my test functions. Are you know saying that all public methods are recognised as tests, regardless of the [Test] attribute?

# re: Nunit backward compatibility

Monday, May 23, 2005 9:46 AM by Rob van der Meijden

Yes, I also always use the [Test] attribute. I even didn’t knew the existence of the Test prefix until I ran into this problem. I removed the [test] attribute and added the Test prefix and the test methods are still recognized by Nunit.

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Please add 4 and 8 and type the answer here: