Cppunit is used to help with unit testing but we have a custom system of testing automation that uses make and bash scripting.
The automation system uses names starting with 3 underscores ___ as names for temp files so don't use that as anything useful.
The create script creates test objects with the prefix utest (utest***.cpp and utest***.h) for the testing code so dont name any production code that.
The system also creates files named awkNameProc, awkNameProc-make, testing.Makefile, testmain.cpp and testcompile in every directory so don't name anything those either.
Lets say you have a module with the following internal structure and directory tree:
Note the fact that there are some duplicate names. Our system handles this.
Now before the production code is written ofcourse the test code should be written. To make the source files for the test classes, say for testing the first lexpart.cpp, you need to create a testlexpart.cpp a testlexpart.h and add them to the test makefile. Its a bit tedious and fraught with errors since cppunit's syntax is a bit wierd so the createtemplate scipt can be used to completely automate this process. To make the test class for the lexpart.cpp just type "createtemplate lexpart". This will make a template "utest_lexpart.cpp" and "utest_lexpart.h" and also add them to "testing.Makefile" appropreately. You can then edit the .cpp and .h files to create the test fixture and thats all you need to do.
To run the tests go to some directory and type "./testcompile" (make sure to include the ./ or it'll run the one in the PATH possably which might not be the one you want) to compile the test and then ./test to run it. "testcompile" will look at all subdirectories for test.Makefile and run them all. After this it will find all built .o files and link them with a special main file to create an executable called "test". Running this file will run all the tests in that module in its entirety. The "createtemplate" script will also make a copy of the "testcompile" script in every directory which allows you to run tests in any directory. So to test a subpart of the module just go in that directory to run the tests and it does so automatically.
If you want certain tests to run while not running others you can do that too. Say you want one fixture to be isolated because its slow. You can go to that fixtures .cpp file and find the line
and change the "main" to something else like "slow" (it is a string type). What this does is it adds this fixture to the "slow" suite instead of the "main" suite. "testcompile" will run the "main" suite by default but if you run it as "testcompile slow" it will run the "slow" suite instead.
You can also include one suite in another which basically runs the first suite whenever the second is said to run. The syntax to do this is
which adds the "which" suite to the "to" suite. This line can be added in nearly any location and cppunit will remember. Also remember both arguments are strings.