GoogleTest integration with CTest

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

GoogleTest integration with CTest

Chad Gilbert
​Hi all,

I'm a new poster on this list. It's nice to meet you.

​ was very excited when I came across the new support for GoogleTest test discovery in CMake ( However, this new approach and the older one both play very poorly with any of my tests that require fixtures.

The situation I have is this: I have about a hundred tests defined which rely on a socket connection that has to pass a few messages each time it's initialized. I define a static test fixture in GoogleTest to make the connection to start the socket connection and initialize the server, then run all of the tests and clean up once when they're all done.

The problem is that when I use `gtest_discover_tests()` (or `gtest_add_tests()`), CTest breaks all of the tests apart into separate processes, adding a couple seconds overhead to each test (the tests themselves take on average a millisecond to run). Perhaps that's still acceptable for now where I've only got ~100 tests that depend on that fixture, but I worry my list of tests will still grow, and it smells like that penalty should be avoidable somehow.

I don't necessarily need to be able to see the output of every CTest (though that's a nice-to-have). What I really need is to be able to see all of the test results in my project CDash. Is there any way to have GoogleTest supply its own test results to CDash such that the GTest executable is only run once, but all of the individual test results can be reported?




Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: