Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google test/mock vs boost vs catch support for c++14/c++17 [closed]

I am evaluating which testing framework would be ideal for me. The choice is among these three: google test, boost.test and catch.

I would like something robust that has not so many dependencies and that is able to support C++14/C++17 if needed.

Another question, do you know which framework big companies in the avionics/space fields use?

like image 246
user3770392 Avatar asked Mar 06 '17 09:03

user3770392


People also ask

Does Google Test support C?

Google test, or gtest is an open source framework for unit testing C\C++ projects.

What is Google mock test?

Google C++ Mocking Framework (or Google Mock for short) is a library (sometimes we also call it a “framework” to make it sound cool) for creating mock classes and using them. It does to C++ what jMock and EasyMock do to Java.

Is Gtest header only?

Google Test is not header-only: there are libraries to build. So, as a Visual Studio user, you have essentially two options.

How do I skip a Gtest test?

If you have a broken test that you cannot fix right away, you can add the DISABLED_ prefix to its name. This will exclude it from execution. This is better than commenting out the code or using #if 0 , as disabled tests are still compiled (and thus won't rot).


1 Answers

I would like something robust that has not so many dependencies and that is able to support c++14/c++17 if needed.

Google C++ test framework requirements mention:

A C++98-standard-compliant compiler

It works just fine with C++14, I personally use it. From the linked documentation you can see that it has no dependencies on external libraries (see section requirements).

Catch known limitations mention:

our desire to support C++98 compilers

It works just fine with C++14, I personally used it in a couple of projects at work. Catch is a header only library, it has no dependencies at all.

Boost C++ libraries usually perform compile-time detection of compiler support for the standards and features are enabled/disabled depending on the result.
As a rule of thumb, those libraries usually depend on some other libraries picked up from Boost itself.

do you know which framework big companies in the avionics/space fields use?

Often they require not only to write tests but also to have a code coverage estimation. There are a plenty of professional tools for that, few of them are for free and (at least, as long as I know) there doesn't exist a standard de facto for that.

like image 156
skypjack Avatar answered Oct 22 '22 14:10

skypjack