Test AttributeAll test need to comply with some rules so that they can be found and executed by the unit testing framework. csUnit is no different. In it's most basic form each test must be public, take no parameters, and must be of type void. csUnit also supports parameterized tests, which take any number of parametes. This is, however, an advanced feature and therefore not discussed here. Generally, csUnit uses reflection to scan test assemblies. If the test implementation follows the rules, csUnit will find the test and will be able to execute it. There are two ways to indicate to csUnit that a method is a test:
If you decide to go for the name convention, then you need to prefix each test with the term "Test", for instance: [TestFixture] In this example csUnit finds this test based on it's name. The second and more flexible option is to use the test attribute to mark a method as a test. In this case the name can be anything you like. An example would be: [TestFixture] Here csUnit will be able to find the test because it has been marked with the TestAttribute, or in short Test. The C# programming language allows you to take the shortcut and omit the postfix "Attribute". |
Sponsors: Sources hosted by
|
|||||||
Copyright © 2002-2009 by Agile Utilities NZ Ltd. All rights reserved. Site design by Andreas Weiss. This site is protected by bot traps. |