May 2017
Intermediate to advanced
590 pages
17h 18m
English
The Google Test framework can also be used with other testing frameworks. You can write tests using another testing framework, such as Boost.Test or CppUnit, and use the Google Test assertion macros. To do so, set the throw_on_failure flag, either from the code or command line, with the --gtest_throw_on_failure argument. Alternatively, use the GTEST_THROW_ON_FAILURE environment variable and initialize the framework, as shown in the following code snippet:
#include "gtest/gtest.h" int main(int argc, char** argv) { ::testing::GTEST_FLAG(throw_on_failure) = true; ::testing::InitGoogleTest(&argc, argv); }
When you enable the throw_on_failure option, assertions that fail will print an error message and throw an exception, which ...
Read now
Unlock full access