Given a large project with thousands of tests, some of which take multiple minutes to complete. When executed sequentially, the whole set of test takes more than an hour to finish. The testing time could be reduced by executing tests in parallel.
As far as I know there are no means to do that directly from googletest/mock, like a --async
option. Or am I wrong?
One solution is to determine the tests which can run in parallel and write a script that starts each in a separate job, i.e.
./test --gtest_filter=TestSet.test1 &
./test --gtest_filter=TestSet.test2 &
...
But this would require additional maintenance effort and introduce another "layer" between the test code and its execution. I'd like a more convenient solution. For example, one could suffix the TEST and TEST_F macros and introduce TEST_ASYNC, TEST_F_ASYNC. Tests defined with TEST_ASYNC would then be executed by independent threads, starting at the same time.
How can this be achieved? Or is there another solution?