Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does google test make test sequence

How google-test makes test sequence (or order of test case execution) for testing test cases?

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?

like image 631
Rasmi Ranjan Nayak Avatar asked Oct 05 '12 09:10

Rasmi Ranjan Nayak


People also ask

How does Google Test work?

Independent and Repeatable: Googletest isolates the tests by running each of them on a different object. Portable and Reusable: Googletest works on different Oses (Linux, Windows, or a Mac), with different compilers. When tests fail, it should provide as much information about the problem as possible.

Does Google Test run tests in parallel?

gtest-parallel is a script that executes Google Test binaries in parallel, providing good speedup for single-threaded tests (on multi-core machines) and tests that do not run at 100% CPU (on single- or multi-core machines).

What is Google Test suite?

The Google Home Test Suite is a web application that allows you to self-test your smart home Action. The Test Suite automatically generates and runs test cases based on the devices and traits associated with your account.


2 Answers

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.

like image 20
BЈовић Avatar answered Sep 22 '22 03:09

BЈовић


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.

like image 187
Peter Wood Avatar answered Sep 19 '22 03:09

Peter Wood