Is there a reason why I should expect CTest to run tests from within a Google Test executable much more slowly than the command line or Visual Studio Test Explorer?
Give an test suite with 744 tests inside a single executable compiled with Google Test, in which there are no filesystem or network interactions:
Just running the executable takes 3.24 s, with the longest individual test taking 3ms to run.
Running all the tests from within Visual Studio 2019 Test Explorer takes 1.6 seconds.
Running the tests from CTest (by just navigating to the binary directory and typing “ctest”) takes 160 seconds (i.e. a full 100X as long as Test Explorer), with every test appearing to take either 0.20 or 0.21 seconds.
What’s the cause of the overhead involved in CTest? Can it be mitigated? As the number of tests in our project grows, it will be hard to justify using CTest if this behaviour is typical.