FCF 2.0 development in progress...
> > > > > >
[News] [C++ Libraries API] [C++ Downloads] [Donate to the project] [Contacts]

group from class fcf::NTest::Test

Property: group

Type: std::string

Class: fcf::NTest::Test

Package: fcfTest

File: test.hpp

Available from version: 1.2.1

The name of the sub-grouping level (Group) within a part.

The group property provides a second level of hierarchical organization. It is used to categorize tests within a specific part.

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 FCF_TEST_DEFINE macro to place tests into specific groups.

#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