The google test framework is pretty standard for C++ language, downside is it's not header-only, upside is it's pretty powerful and supports a load of platforms. Which is great if you work in an embedded or cross-platform setup. The makers of googletest (google, of course) currently prefer Bazel, but you can use CMake which I'm doing.
| gtest.cc |
Commandline args?
--gtest_fail_if_no_test_linked (flag)
This flag is pretty much the only defence against silent failure for those cases where none of your tests get recognised by the framework and the binary runs and silently finds no tests. You have errors, but you have no tests that ran!
--gtest_output="xml:DATA/TestResultTests.xml" (file as argument)
Specifies XML (or Json) output format and where to drop the results. The default is in the working directory and that can just get messy for wildcard test result collectors in the CI/CD system.
--gtest_list_tests
--getest_filter="Suitename*"
Which corresponds to your TEST_F() or TEST() macro first identifier passed in. It's also thus possible to run all tests ending in the word serial:
--getest_filter="*Serial"
will run
TEST(TestOpen, ReadSerial)...
TEST(TestWrite, WriteSerial)...
--repeat (integer)
Is the other option I will use often enough.
Comments
Post a Comment