groupOrder from class fcf::NTest::Test
Type:
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.1
Sets the execution priority for a specific group.
The
This is useful when certain groups of tests within a module have dependencies on others, or when you want to prioritize specific functional areas during a test run.
Example: Ordering Groups within a Part
Demonstrating how to use
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
FCF_TEST_DEFINE ("Auth", "Login", "Test1") {
const fcf::NTest::Test & test = fcf::NTest::state ().test ();
fcf::NTest::log () << "Group order: '" << test.groupOrder << std::endl;
FCF_TEST (true);
}
FCF_TEST_DEFINE ("Auth", "Logout", "Test2") {
const fcf::NTest::Test & test = fcf::NTest::state ().test ();
fcf::NTest::log () << "Group order: '" << test.groupOrder << std::endl;
FCF_TEST (true);
}
// Ensure 'Login' group runs before 'Logout' group
FCF_TEST_GROUP_ORDER ("Login", 1);
FCF_TEST_GROUP_ORDER ("Logout", 2);
int main(int a_argc, char* a_argv[]) {
bool error = false;
fcf::NTest::cmdRun (a_argc, a_argv, fcf::NTest::CRM_RUN , &error);
return error ? 1 : 0;
}
Output:
Performing the test: "Auth" -> "Login" -> "Test1" ...
[SUCCESS] Test completed successfully (0.000`000`100 sec)
Performing the test: "Auth" -> "Logout" -> "Test2" ...
[SUCCESS] Test completed successfully (0.000`000`100 sec)
[SUCCESS] All tests were completed.
Tests: 2 passed, 0 failed, 0 skipped, 2 total
Duration: 0.000`000`200 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.