Search The Blog
About this site

@RoyOsherove

Subscribe!

This site aims to connect all the dots of my online activities - from tools, books blogs and twitter accounts, to upcoming conferences, engagements and user group talks.

from 5whys.com
Twitter: @RoyOsherove
My Book: The Art of Unit Testing
Latest Posts
« 2010 Poll: Which Isolation Framework do you use in .NET? | Main | Two different ways to create bad logic in unit tests »
Monday
Sep062010

Unit Testing in C++ is harder than..

Unit Testing in C++ – it’s even harder than Inidian Pole Gymnastics

I mean seriously - CPPUnit is the devil. What kind of test framework do you use in C++?

PrintView Printer Friendly Version

Reader Comments (1)

It's a shame you lost all the comments when you migrated your blog.
However it gives me a second chance at "first post" ;-)
I mentioned in the original comments that I was working on my own C++ unit test framework (in recognition of your observation that the current state of play is not great - even to this day).

I have now made some headway on that framework and am nearly ready to publicize it more widely. It already has quite a bit of interest on the ACCU mailing list.

Introducing CATCH.

Key features are:

* Implemented all in headers - no libs to build!
* No external dependencies (just C++03)
* Simple, expressive test macros (more on that in a moment).
* Self-registering test cases (both as free functions and as methods)
* Can break into the debugger on failing line (Windows & Mac)
* Multiple reporter formats (extendible) including a Junit reporter for CI integration.
* Nestable sections for BDD style test cases.
* Powerful test data generators for arbitrary ranges (coming soon).
* Objective-C bindings

There's more but I should stop there (check out the wiki on the GitHub page for more).

Just on the "expressive test macros bit" - what I mean is you can write, for example:

REQUIRE( a == b );

Note that standard C/C++ operators are used instead of a whole set of different assertion macros. Yet if the test fails you'll get the values of a and b printed out independently!

Anyway - if this has got your interest take a look at the GitHub project:

https://github.com/philsquared/Catch

December 27, 2010 | Unregistered CommenterPhil Nash

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>