I’ve been aware of Extreme Programming (XP) for quite some time now. Unfortunately, due to the type of work that I’ve been doing for the past few years, I’ve never had the occasion to use it on real production code.
One of the things that fascinates me the most about XP is its emphasis on automated unit testing. I spent quite a bit of time experimenting with it in Java about a year ago, after first seeing references to it in Martin Fowler’s most excellent book: Refactoring. I just spent a bit of time over at Wiki reading Code Unit Test First. I particularly love the analogy Rob Crawford wrote:
“It struck me last night while painting a wall: CodeUnitTestFirst is the programming equivalent of using masking tape and drop cloths. On the surface it doesn’t look like you’re making “progress”, but the safety it gives you lets you work faster and safer.”
But I’m programming exclusively in C++ these days. So, after some helpful suggestions from the folks on the DOTNET list, I turned to CppUnit, which is essentially a port of JUnit over to C++. All I wanted to do was to create a “Hello, World” application using CppUnit. But guess what? The docs suck, and I battled with bizarro compiler switch settings for about half an hour before finally getting the thing to build successfully. This article is a summary of what you need to do to get your first “Hello, World” CppUnit unit testing application up and running.