Even if you can guess some pattern for the order of execution (as written, or linked) you shouldn't depend on that.
It would be repeated on different executions, though. If you don't want it to happen, you can use --gtest_shuffle
. That runs the test on a random order, according to a random seed.
In case of failure, you can use --gtest_random_seed=
with that number and repeat the exact sequence (to investigate why it failed).
That said, the randomness is not complete:
- Test suites will be run in a random order
- Tests within a test suite will be run in a random order
If not run in this way, SetUpTestSuite and TearDownTestSuite methods would be mixed. You don't need a fixture for this grouping to happen, though.
--gtest_shuffle
flag. – Worthington