group from class fcf::NTest::Test
Property: group
Type:
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.1
The name of the sub-grouping level (Group) within a part.
The
This allows for granular control over test execution. For example, within a "Database" part, you might have groups like "Connection", "Queries", and "Transactions".
Example: Organizing Tests into Groups
Demonstrating how to use the
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
// Test in the 'Database' part, 'Queries' group
FCF_TEST_DEFINE ("Database", "Queries", "SelectTest") {
const fcf::NTest::Test & test = fcf::NTest::state ().test ();
fcf::NTest::log () << "Testing in the group '" << test.group << "'..." << std::endl;
FCF_TEST (true);
}
// Test in the 'Database' part, 'Connection' group
FCF_TEST_DEFINE ("Database", "Connection", "ConnectTest") {
const fcf::NTest::Test & test = fcf::NTest::state ().test ();
fcf::NTest::log () << "Testing in the group '" << test.group << "'..." << std::endl;
FCF_TEST (true);
}
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: "Database" -> "Connection" -> "ConnectTest" ...
> Testing in the group 'Connection'...
[SUCCESS] Test completed successfully (0.000`004`814 sec)
Performing the test: "Database" -> "Queries" -> "SelectTest" ...
> Testing in the group 'Queries'...
[SUCCESS] Test completed successfully (0.000`001`620 sec)
[SUCCESS] All tests were completed.
Tests: 2 passed, 0 failed, 0 skipped, 2 total
Duration: 0.000`006`434 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.