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:

   [TestFixture]
   public class FacadeTests {
      [Test]
      public void WithEmptyID() {
         ...
      }

      [Test]
      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.

Important Rules

  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 fixture 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.

v2.4 Documentation Home

Prerequisites And Target Environment

Attributes

Categories

Options Dialog

Parameterized Tests

Recipes

Selectors



Web csunit.org

Sponsors:

Extreme Simplicity Logo

Agile Utilities Logo

Blue Note Ventures Logo


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



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