[bind10-dev] C++ unit test tool?

JINMEI Tatuya / 神明達哉 jinmei at isc.org
Tue Oct 20 08:33:32 UTC 2009


At Mon, 19 Oct 2009 12:02:15 +0200,
Stephane Bortzmeyer <bortzmeyer at nic.fr> wrote:

> > is there a better unit test tool for C++?
> 
> There is a good discussion of the various test tools for C++:
> 
> http://gamesfromwithin.com/exploring-the-c-unit-testing-framework-jungle
> 
> At the time it was written, it seems the Google tool did not exist:
> 
> http://code.google.com/p/googletest/

Thanks for the pointers.  The gamesfromwithin link has been added to
the bind10 dev site (http://bind10.isc.org/wiki/EngineeringBits) but
I've not read it.

I've played with CxxTest and googletest, and committed the same set of
test code for these three frameworks to a svn branch:
http://bind10.isc.org/browser/branches/jinmei-cppunittests/src/lib/dns

The test cases may be too simple to make meaningful comparison, but
here are my impressions:

- although it's a minor difference in this simple example, CppUnit
  has more redundant syntax: I needed to type the test function name
  three times while I only had to do it once with CxxTest and
  googletest.
- The gamesfromwithin article gives a lower score to CppUnit due to
  its dependency on some C++ language features such as exception and
  RTTI.  I personally don't think it's a strong disadvantage for us
  (although fewer dependencies are always good in general, of course):
  we'll probably use reasonably modern compilers for our development.
- Likewise, while CxxTest depends on perl, that wouldn't be a problem.
- I've not seen a clear difference between CxxTest and googletest in
  terms of features I'd want to have.  googletest seems to have
  richer functionality, but I'm not sure if I need fancy features.
- googletest is released under a BSD license, which would be most
  compatible with BIND10's own license.  But, as also noted in the
  gamesfromwithin article, LGPL is probably okay as the resulting
  product won't directly use the test framework code.

If I needed to make a decision right now, I'd probably choose
googletest, but it's not a strong preference.

---
JINMEI, Tatuya
Internet Systems Consortium, Inc.



More information about the bind10-dev mailing list