1.5. Choosing a Unit Test Framework

Basically mockpp should work with every unittesting framework. It does not necessarily need advanced features like runtime type information (RTTI) or exceptions. But if possible they should both be used. RTTI provides some information about the actual type in use. And exceptions help to avoid resource leaks since the compiler adds code to destruct automatic variables.

The following section lists frameworks which have actually been used to verify the correctness of mockpp. Each of the frameworks supports the automatic registration of tests. Additionally mockpp contains some specialised macros for better integration.

1.5.1. CppUnit

Tests with CppUnit are usually grouped in classes. A method contains one single test. Each of the tests is typically registered automatically with a test runner by using some macros. This is internally done by instantiating a static variable.

CppUnit does not need RTTI to work but it relies on exceptions to check assertions and report the results.

At runtime each of the methods are then invoked in unspecified order.

class AssertMo_test : public  CppUnit::TestFixture

  CPPUNIT_TEST_SUITE( AssertMo_test );

  void test_A_includes();

void AssertMo_test::test_A_includes()