I am involved in starting up an effort to convert the unit tests for a rather large C-code base (>3MLOC) from a "homegrown" unit test framework to CppUnit.
A problem we have encountered is that when registering test suites with the CPPUNIT_TEST_SUITE_REGISTRATION macro, they are executed in basically an undeterministic order (CppUnit 1.12.0/Windows/VS2005). We need to be able to control the execution order, that is, we want them executed in the order the macros are stated.
I think this would be a reasonable requirement?
Some digging in the framework reveals that the underlying container for the registered suites is an STL set, which sorts the entries depending on the value of the object pointer. I did a "quick-and-dirty" fix by implementing my own comparison, using a counter that is incremented in the constructor of the TestFactory object. A better solution could be to use an STL list instead?
We would of course very much prefer this to be incorporated in the framework, instead of maintaining our own. If I get some hints on a suitable solution, I could attempt and contribute an implementation.
Log in to post a comment.