This post originated from an RSS feed registered with Agile Buzz
by Kevin Rutherford.
Original Post: CxxTest is different from JUnit
Feed Title: silk and spinach
Feed URL: http://silkandspinach.net/blog/index.xml
Feed Description: kevin rutherford on agile software development and life in macclesfield
I've been stretching my TDD practice recently by dipping into the murky world of C++ again after a break of a few years. After reading a number of comparisons - notably this one by Noel Llopis - we settled on CxxTest as the project's TDD framework. I then spent a few days converting and refactoring a few existing tests, and writing a load of new ones, to get an initial test suite going.
I discovered one big surprise along the way: unlike JUnit et al, each test suite class is only instantiated once, regardless of how many testXXX() methods it has. This means that the suite's setUp() and tearDown() methods are always acting on the same fixture instance throughout the test run; and the test suite's constructor is only invoked once. So for test independence it's essential to only put pointers into the test's state, so that all test objects can be safely deleted.
Another minor irritation is that CxxTest doesn't easily allow me to run a subset of the tests. This is a useful feature when working with legacy code, because it's sometimes hard to locate a crash among a few hundred tests.
What else should I know about? Are there any other gotchas? Have you found other styles of working with CxxTest?
(Note: CxxTest is also commonly - and mistakenly - known as CxxUnit.)