For a series of reason, I’m interested in writing unit tests for a few project, one of which will probably be my 1.3 branch of xine-lib (Yes I know 1.2 hasn’t been released yet in beta form either).
While unit tests can be written quite easily without much framework, having at least a basic framework would help to make automated testing possible. Since the project I have to deal with use standard C, I started looking at some basic unit test frameworks.
Unfortunately, it seems like both CUnit and check have last seen a release in 2006, and their respective repositories seem quite calm. In case of CUnit I also have noticed a quite broken buildsystem.
Glib seems to have some basic support for test units, but even they don’t use it so I doubt it’d be a nice choice. There are quite a few unit testing frameworks for particular environments, like Qt or Gnome, but I haven’t found anything generic.
It seems funky that even if people always seems to cheer test-driven development there isn’t a good enough framework for C. I think Ruby, Java, Perl and Python have already their well established frameworks, and most of the software use that, but there is neither a standard nor a widely accepted framework for C.
I could probably write my own framework but that’s not really an option, I don’t have so much free time to my hands, I suppose the less effort would be to contribute to one of the frameworks already out there, so that I can fix whatever I need fixed and have it working as I need. Unfortunately, I’d have to start looking at all of them and find the less problematic before I start doing this, and it is not useful if the original authors have gone MIA or similar, especially since at least CUnit was still developed using CVS.
If somebody have suggestions on how to proceed, they are most welcome. I could probably fork one of them if I have to, although I dislike the idea. Out of what I gathered quite briefly, the presence of XML generation for results in CUnit might be useful to gather up tests’ statistics for an automatic testing facility.
Hello,Did you took a look to the xUnit (cunit, cppunit, junit, …) frameworks, used in eXtreme Programming?
I’ve used check recently and I’ve been mostly satisfied (appart from the fact that its not thread safe). I think one of the reasons it has not been developed much is that is that it does what its supposed to do well.GTest (from glib) also seems ok. But I have little experience with the other frameworks out there.That said, any “simple” framework will do, you’ll probably want to code some “custom” stuff for your projects (common initialisation, etc) anyways.
ATF is one framework I’ve used from time to time;http://www.netbsd.org/~jmmv…This hardly says anything, since I have been asking the same questions as you several times. Somehow I feel that unit testing is an area in which the “universal framework” you mention do not exist. Nor can it exist. Projects are way too different, meaning also different requirements of reliability and testability.As you said, perhaps the project-specific route is the way to go. Write your own.