In the process of setting our C++ unit testing framework for the next years we shortlisted GoogleTest and CppUnit. I have some experience with both and my heavy preference is GoogleTest. Anyways to convince my boss I need some facts so I did some reading on the Internet, including the manuals, wiki pages and some of the sources. I came up with a list of GoogleTest advantages and a single CppUnit advantage(graphic test runners). Here they are ordered by perceived usefulness:
Am I correct in assuming that all of the above are not supported by CppUnit? Is there an useful GoogleTest feature not available in CppUnit I am missing?
And last but not least: Are there any nice CppUnit features that GoogleTest lacks?
Thanks!
Google Test (also known as gtest) is a unit testing library for the C++ programming language, based on the xUnit architecture. The library is released under the BSD 3-clause license.
Google test, or gtest is an open source framework for unit testing C\C++ projects.
String Comparison If you want to compare two string objects, use EXPECT_EQ , EXPECT_NE , and etc instead. Note that "CASE" in an assertion name means that case is ignored. A NULL pointer and an empty string are considered different.
If you use older version of gcc compiler or if your code under tests runs on vxWorks (or VxSim) you might have a better chance with cppUnit than Googletest framework.
On the other hand, another feature of the googletest framework is availability of 3 different levels of setup/teardown:
Not sure if this is supported in cppUnit, but this might come very handy, especially with legacy systems.
Also, there is a googletest plugin for Eclipse CDT.
If you haven't looked at xUnit++, I made it specifically because I was unhappy with what was available (including gtest). Most of your list is supported, and if not, if it's a "must have" feature, I'd probably be willing to add it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With