I have been working on AbiWord unit test framework. I went with ripping WvTest off WvStreams for integration into the source tree. It is pretty straightforward and quite simple to use; all that I wanted. If it is too complicated people won't use it, like it is with the use of Doxygen for our own internal documentation.

Here is a little overview on how it works:

#include "tf_test.h"
#include "my_source.h"

TFTEST_MAIN("test decription")
	my_class c;

It is all integrated in the build system and even use valgrind APIs as a bonus. I need to put some more polish before committing it. No problem, 2.2 is still not branched. Stuff left to do is:

  • create the test make target
  • wrap to run valgrind if found
  • change configure to detect valgrind APIs (used by the test)
  • finish the documentation
  • write more unit test

Unit testing is probably really boring, but it is really really useful. You can find a breakage on the core of the code with it, you can even use it to develop your code. I did that for a few weeks, because either I couldn't run the whole beast or because it is was simplier. I did wrote my C++ code and write the unit test at the same time (required by internal company policy) and then just test everything with a make test. When I finally ran the whole program it was working by itself. Writing unit test does not take a long time if you do it at the same time and use them for immediate testing.