On first sight, it seems that Google Test doesn't provide much over CppUnit. However, when I look a bit deeper into the advanced part of the manual, I'm finding interesting new things. Maybe it would be good to have a list of features why one would choose Google Test over CppUnit?
Btw, I had to apply the following patch to make it compile for me:http://el-tramo.be/files/gtest/gtest-1.0.0-includeinternal.patch
I am with remko about a list of features that puts this testing framework apart from others, like CppUnit or Boost's Unit Test Framework.I was able compile it without modifications on Ubuntu, though.
I too am curious about why anyone would choose this over boost::test...
Death tests are a pretty cool feature, though currently only available on Linux. They let you verify that your asserts trigger when they're supposed to. The syntax is really simple, too:EXPECT_DEATH(MyFunction(bad_input));Not sure if any other unit testing frameworks support that.
Am I the only one that is bothered by names of things & what one must type to use this?EXPECT_DEATH(...)should actually be a fatal assertion, and a non-fatal one should be:EXPECT_LIFE_AFTER_DEATH(...)There, now it seems right.
Oops, my example was wrong. It's actually:EXPECT_DEATH(MyFunction(bad_input),"expected error message");maksa: not sure what you mean. Note that EXPECT_DEATH (and ASSERT_DEATH) executes the crashing code in a sub-process, which allows the unit test to continue running after the crash.
kenton wrote:>> maksa: not sure what you mean Pay no mind, it was just an attempt at a (probably bad) joke, with no pretensions on some technical merit whatsoever. It is really fine that Google released this, so far my choice has been UnitTest++ http://unittest-cpp.sourceforge.net/It's a bit troubling that this Google thing is yet another C++ unit testing framework, albeit it seems to be the most powerfull so far - if I had a greenfield project I'd most probably go for it. The other (real) problem is how to convnice more people to do unit testing. Still waiting for some magic in that area, and if any of you actively blogging people managed to successfully introduce TDD/UT in his work environment (by "successfully introduce" I don't mean "nobody killed you for writing unit tests"), please don't be shy to write about your experience.
Doh, I guess I need to write better tests for my humor detector. ;)
Hi, I created a new website and expecting your comments on it.http://www.prog2impress.com/index.html
The google test primer link appears to be misdirected. It should direct to : http://code.google.com/p/googletest/wiki/Primer
The comments you read and contribute here belong only to the person who posted them. We reserve the right to remove off-topic comments.