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

part from class fcf::NTest::Test

Property: part

Type: std::string

Class: fcf::NTest::Test

Package: fcfTest

File: test.hpp

Available from version: 1.2.1

The name of the logical grouping level (Part) to which the test belongs.

The part property represents the highest level of organization in the test hierarchy. It allows users to group related tests into large logical modules (e.g., "Network", "Database", or "Core").

This grouping is essential for:

  • Filtering tests during execution using the cmdRun interface.
  • Defining execution order for entire modules via partOrder.
  • Organizing test reports into a clear, hierarchical structure.

Example: Defining a Test within a Part

Demonstrating how to assign a part name to a test case using the FCF_TEST_DEFINE macro.

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> // Define a test case within the "Math" part FCF_TEST_DEFINE("Math", "Arithmetic", "AdditionTest") { const fcf::NTest::Test& test = fcf::NTest::state().test(); fcf::NTest::log() << "Testing addition in the part '" << test.part << "'..." << std::endl; FCF_TEST(2 + 2 == 4); } int main(int a_argc, char* a_argv[]) { bool error = false; // The test will be registered under the part "Math" fcf::NTest::cmdRun(a_argc, a_argv, fcf::NTest::CRM_RUN, &error); return error ? 1 : 0; }

Output:

Performing the test: "Math" -> "Arithmetic" -> "AdditionTest" ... > Testing addition in the part 'Math'... [SUCCESS] Test completed successfully (0.000`007`568 sec) [SUCCESS] All tests were completed. Tests: 1 passed, 0 failed, 0 skipped, 1 total Duration: 0.000`007`568 sec