1.5.2. CxxTest

The original working method of CxxTest is different to CppUnit. A perl script searches the test sources and creates an additional source file which is then compiled and run. All the library source files are directly included into the main source file which means that you do not need to create a binary library for CxxTest.

Since not every environment supports the execution of a perl script within the edit-compile cycle mockpp contains some additional macros similar to CppUnit which register the test methods automatically at runtime. The main difference is the fact that the macros are located outside the class. Additionally the version of CxxTest included in mockpp comes as binary library which should help to save some memory and download time which is important on embedded platforms.

CxxTest does neither need RTTI nor exceptions to work. But it is possible to check exception conditions.

Similar to CppUnit the test methods are invoked in unspecified order.


class AssertMo_test : public  CxxTest::TestSuite
{
 public:

  void test_A_includes();
};

void AssertMo_test::test_A_includes()
{
  ...
}

MOCKPP_CXXTEST_SUITE_REGISTRATION( AssertMo_test );
MOCKPP_CXXTEST(AssertMo_test, test_A_includes);