A new player is Google Test (also known as Google C++ Testing Framework) which is pretty nice though.
#include <gtest/gtest.h>
TEST(MyTestSuitName, MyTestCaseName) {
int actual = 1;
EXPECT_GT(actual, 0);
EXPECT_EQ(1, actual) << "Should be equal to one";
}
Main features:
- Portable
- Fatal and non-fatal assertions
- Easy assertions informative messages:
ASSERT_EQ(5, Foo(i)) << " where i = " << i;
- Google Test automatically detects your tests and doesn’t require you to enumerate them in order to run them
- Make it easy to extend your assertion vocabulary
- Death tests (see advanced guide)
SCOPED_TRACE
for subroutine loops- You can decide which tests to run
- XML test report generation
- Fixtures / Mock / Templates…