We’ve decided to replace UnitTest++ with googletest
The first thing to notice:
Remember, when they fail, ASSERT_* yields a fatal failure and returns from the current function, while EXPECT_* yields a nonfatal failure, allowing the function to continue running. In either case, an assertion failure means its containing test fails.
Remarkable modification:
- CHECK => (ASSERT|EXPECT)_TRUE
- CHECK_EQUAL => (ASSERT|EXPECT)_EQ
- CHECK_EQUAL => (ASSERT|EXPECT)_STREQ (if you’re comparing strings, such as (char *result)
- For Test Fixture, UnitTest++ only provides constructor/destructor for SetUp()/TearDown(), where Google Test provides SetUp()/TearDown().
Note that different tests in the same test case have different test fixture objects, and Google Test always deletes a test fixture before it creates the next one. Google Test does not reuse the same test fixture for multiple tests. Any changes one test makes to the fixture do not affect other tests.
The best thing what unittest++ doesn’t have, but gtest has:
- Getting the Current Test’s Name
Sometimes a function may need to know the name of the currently running test. For example, you may be using the SetUp() method of your test fixture to set the golden file name based on which test is running.
Reference:
- Musings on C++ Testing Tools
- Google Mock
- 玩转Google开源C++单元测试框架Google Test系列(gtest)(总)玩转Google开源C++单元测试框架Google Test系列(gtest)(总)
What makes you decide to switch test framework?
According to the dev team’s commits, reponses to comment, and activities :p