The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

What is a good unit-test framework for C?

Stuff that would be useful in a unit-test framework for our company:

* Minimal work to add new testcases. The less code a developer needs to write the better. More code means more errors and slower development.
* Support for C++ code. This is not needed right now but might be in the near future.
* support setup/teardown steps.
* Ability to lump testcases together in suites.
* Easy to modify if there is something we want to add.

I've looked at CxxTest was good, but it only supports C++ it seems.

Any suggestions appreicated.
Nick Send private email
Friday, March 23, 2007
How about CPPUnit? The framework is C++, but there's no reason why the methods of your test case classes/suites couldn't consist of invoking C functions.
Christopher Wells Send private email
Friday, March 23, 2007
I've used check, a little. It seemed ok from the short amount of time I spent with it.
Friday, March 23, 2007
CppUnit augmented with a samll scripts worked well.

The script allowed me to quickly add test cases for specific classes, or which would create the test cases from class definitions. Definitely worth the trouble of writing.
-L Send private email
Friday, March 23, 2007
+1 cppunit

I've used it with C++ and plain old C
Mike S Send private email
Friday, March 23, 2007
Another for check.  For simple to get started with, and I've used it for some C++ without any hassle.

I've never used CppUnit so I'm not aware of what I'm missing out on.
jason Send private email
Saturday, March 24, 2007
+1 for CPPUnit. Works very well.
QADude Send private email
Sunday, March 25, 2007
We're using NUnit to test our native code (C++). The same trick will work on plain C - only the test harnesses need to be C++ (MC++ or C++/CLI).

Of course, one of the reasons we're doing it is to support testing of multi-language projects, and improve our knowledge of the .NET framework.

One of the native C++ unit test tools may however suit you better. I've head good things about CxxUnit...I personally found CppUnit a big messy to use (NUnit is a model of clarity by comparison) but Beth swears by it.
Anna-Jayne Metcalfe Send private email
Monday, March 26, 2007

Cppunit seems pretty good. Does any of you guys know how much work it is to add new testcases? Is it a hassle or easy?

Nick Send private email
Tuesday, March 27, 2007

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz