Posts tagged ‘unit testing’

February 3rd, 2009

C++ Unit Testing

As part of my plan to handle testing I will incorporate some unit testing. In order to make the unit tests easier to develop and run I will use a Unit testing framework. Not having much experience with unit testing in general I will be looking for something fairly simple. I’d like to keep my dependencies on other languages down so I would like a framework that supports the writing of test cases and test suites in C++ and not a 3rd party language (scripting language).

I came across the following while searching around for C++ Unit Test frameworks:

  • CppUnit – it started out as port of jUnit, a testing framework for Java. While it seems to have a the features required of a unit testing framework, I feel that it may require a bit more work in setup. It has to be built and installed as a library.
  • MiniCppUnit – improves size wise on CppUnit coming in at ~500 lines and it doesn’t require a library installation
  • cutee – stands for C++ Unit Testing Easy Enviornment and reduces the amount of boiler plate code needed for creating unit tests
  • unit– – like cutee a simple and easy to use unit testing framework

After looking over these frameworks, I decided to go with the unit– framework it provides a very simple and easy API in the form of Macros that allow for quick creation of tests.