I recently integrated Google's GTest unit testing framework into one of my projects. I am using CMake to build my library (the actual project), the unit tests, and the Google test libraries. This system seem to work great.
My issue is in properly running the tests and showing the coloured Google test output in a verbose manner. In short, my goal is to see the execution of all tests with the proper coloured output. See the bottom of this page for a look at the expected output:
I added the tests in my top level CMakeLists.txt file like this:
enable_testing()
add_test(NAME unit-test COMMAND unit-test)
After running cmake and building with the generated makefile, I run the test with:
make test
Which produces this summary:
Running tests...
Test project /home/tm-tr05/Projects/cmake_test/libxct/build
Start 1: unit-test
1/1 Test #1: unit-test ........................ Passed 0.00 sec
100% tests passed, 0 tests failed out of 1
However, when I run ctest directly like this:
ctest -R unit-test -VV
I can see a glimpse of the full GTest output I am expecting:
1: Test command: /home/tm-tr05/Projects/cmake_test/libxct/build/test/unit-test
1: Test timeout computed to be: 9.99988e+06
1: Running main() from gtest_main.cc
1: [==========] Running 1 test from 1 test case.
1: [----------] Global test environment set-up.
1: [----------] 1 test from ListTest
1: [ RUN ] ListTest.AddNumbers
1: [ OK ] ListTest.AddNumbers (0 ms)
1: [----------] 1 test from ListTest (0 ms total)
1:
1: [----------] Global test environment tear-down
1: [==========] 1 test from 1 test case ran. (0 ms total)
1: [ PASSED ] 1 test.
1/1 Test #1: unit-test ........................ Passed 0.00 sec
How can I get the full coloured GTest test output when running with "make test"? Thank you very much for any help you can provide. This has been really grinding my gears.
Aucun commentaire:
Enregistrer un commentaire