How does google test make test sequence
How does google test make test sequence
How google-test makes test sequence (or order of test case execution)
for testing test cases?
(or order of test case execution)
Suppose I have 5 test cases.
TEST(First, first)
TEST(Secnd, secnd)
TEST(Third, third)
...
TEST(Fifth, fifth)
How google-test
test above test cases? I mean in what sequence?
Or can we provide any test sequence?
google-test
3 Answers
3
The advanced reference pages for googletest in the chapter Shuffling the Tests tells :
By default, Google Test uses a random seed calculated from the current time. Therefore you'll get a different order every time.
This is actually a good way of unit testing, since tests should not depend on the order of execution.
As far as I know, there are no ways of setting the order of tests execution. The only parameter you can set is the seed, used to set the same order of execution.
--gtest_shuffle
By default it will test them in the order it finds them at link time, which will depend upon your tools.
You can select which tests to run, such as a subset, or a single test.
There is also an option to run them in a random order.
By default they run in the declaration order. As said by other, you have to provide the flag --gtest_shuffle to shuffle them.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
That (random order of execution) is true only if you specify the
--gtest_shuffle
flag.– user1284631
Mar 7 '13 at 10:22