Visual Assert – The Unit Testing Add-In for Visual C++
cfix – C/C++ Unit Testing for Win32 and NT




TestFixture is the base class all test classes have to publicly derive from. Such a test class groups multiple tests to form a single fixture. That is, all methods of a test class share a common environment, i.e. variables, initialization and cleanup logic.

Tests are implemented by adding arbitrarily named methods to the respective class. If required, initialization and cleanup logic can be implemented by overriding the methods Before and After, respectively. These methods may, for example, be used to initialize and free member variables of the respective test class. Such variables may then be used by the test methods.

In a similar manner, setup and teardown methods may be implemented to initialize and cleanup global resources. In contrast to before and after routines, these routines run only once per test run. The state maintained by setup and teardown routines is thus shared among all tests.

For each test class, a corresponding CFIXCC_BEGIN_CLASS/ CFIXCC_END_CLASS construct must be provided.
namespace cfixcc
  class TestFixture
    virtual ~TestFixture();

    virtual void Before();
    virtual void After();

    static void SetUp();
    static void TearDown();