2.1 Other Frameworks for C
The authors know of the following additional unit testing frameworks
for C:
- GNU Autounit
- Much along the same lines as Check, including forking to run unit
tests in a separate address space (in fact, the original author of
Check borrowed the idea from GNU Autounit). GNU
Autounit uses GLib extensively, which means that linking and such need
special options, but this may not be a big problem to you, especially
if you are already using GTK or GLib. See the
GNU Autounit homepage.
- cUnit
- Also uses GLib, but does not fork to protect the address space of unit
tests. See the
archived cUnit homepage.
- CUnit
- Standard C, with plans for a Win32 GUI implementation. Does not
currently fork or otherwise protect the address space of unit tests.
In early development. See the CUnit homepage.
- CppUnit
- The premier unit test framework for C++; you can also use it to test C
code. It is stable, actively developed, and has a GUI interface. The
primary reasons not to use CppUnit for C are first that it is quite
big, and second you have to write your tests in C++, which means you
need a C++ compiler. If these don't sound like concerns, it is
definitely worth considering, along with other C++ unit testing
frameworks. See the
CppUnit homepage.
- MinUnit
- A minimal set of macros and that's it! The point is to
show how easy it is to unit test your code. See the
MinUnit homepage.
- CUnit for Mr. Ando
- A CUnit implementation that is fairly new, and apparently still in
early development. See the
CUnit for Mr. Ando homepage.
This list was last updated in March 2006. If you know of other C unit
test frameworks, please send an email plus description to
check-devel@lists.sourceforge.net and we will add the entry
to this list.
It is the authors' considered opinion that forking or otherwise
trapping and reporting signals is indispensable for unit testing (but
it probably wouldn't be hard to add that to frameworks without that
feature). Try 'em all out: adapt this tutorial to use all of the
frameworks above, and use whichever you like. Contribute, spread the
word, and make one a standard. Languages such as Java and Python are
fortunate to have standard unit test frameworks; it would be desirable
that C have one as well.