Home Download Documentation Getting Started Support Other Versions

Test Fixtures

A test fixture is basically a class that contains tests.

csUnit supports two different techniques for decorating test fixtures within an assembly:

  1. Attribute based
  2. Name based

For the first approach, csUnit's runtime inspects all publicly visible types within an assembly. All classes that have the attribute TestFixtureAttribute will be available for execution. The following is an example of such a class:

   public class FacadeTests {
      public void WithEmptyID() {

      public void SystemIDReturnsAdminObject() {

The second option is to follow a certain name convention that was originally introduced by JUnit. csUnit finds all classes with a prefix "Test". This search is case insensitive, so it will also find all classes beginning with "test", "TEST", "tESt", "TesT", etc.

Rules and Recommendations

  1. csUnit searches only publicly visible types. In C# this means that you must declare the test fixture as public. csUnit will not find test fixtures that are internal or private.
  2. Your test fixtures don't have to have a special base class. Also, they don't have to implement a special interface. If there is however code that your tests share, you may want to consider a common base class for some test fixtures.


Extreme Simplicity Logo

Agile Utilities Logo

Sources hosted by

Get csUnit - unit testing for .NET at SourceForge.net. Fast, secure and Free Open Source software downloads

Copyright © 2002-2009 by Agile Utilities NZ Ltd. All rights reserved. Site design by Andreas Weiss. This site is protected by bot traps.