Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comparison of C++ unit test frameworks [closed]

I know there are already a few questions regarding recommendations for C++ unit test frameworks, but all the answers did not help as they just recommend one of the frameworks but do not provide any information about a (feature) comparison.

I think the most interesting frameworks are CppUnit, Boost and the new Google testing framework. Has anybody done any comparison yet?

like image 229
housemaister Avatar asked Oct 28 '08 11:10

housemaister


People also ask

What is the best unit test framework for C?

The most scalable way to write unit tests in C is using a unit testing framework, such as: CppUTest. Unity. Google Test.

What are the famous unit test framework options available for C #?

The three major C# Unit testing frameworks are MSTest, NUnit, and xUnit.Net.

Which is better NUnit or MSTest?

The main difference is the ability of MsTest to execute in parallel at the method level. Also, the tight integration of MsTest with Visual Studio provides advantages in both speed and robustness when compared to NUnit. As a result, I recommend MsTest.

Is xUnit better than NUnit?

Both frameworks are awesome, and they both support parallel test running (in a different way though). NUnit has been around since 2002, it's widely used, well documented and has a large community, whereas xUnit.net is more modern, more TDD adherent, more extensible, and also trending in . NET Core development.


1 Answers

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...
like image 58
Wernight Avatar answered Sep 23 '22 10:09

Wernight