Property
iterations
The number of times to invoke the test (default=1).
struct TestOptions {
int32_t iterations;
}
Discussion 🔗
Sets the number of times the test case executes. By default, each test case only executes once.
The following example causes the test case to execute three times:
TEST(yourSuite, yourTest, .iterations=3) {
// ...
}
If the iterations value is set to DYNAMIC_ITERATIONS then the number of iterations is controlled dynamically with SET_TEST_ITERATIONS. If SET_TEST_ITERATIONS is never called, then the number of iterations defaults to zero and the test is never invoked.
The current iteration index is obtained with TEST_ITERATION.
The iterations option is useful for defining parameterized tests. Parameterized tests are test cases that are invoked multiple times with different data. Using this option, in conjunction with TEST_ITERATION, you can execute the same test case multiple times while extracting test data from an array.