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

fcf::NTest::cmdHelp() function

Package: fcfTest

File: test.hpp

Available from version: 1.0.1

Outputs help information regarding available command-line arguments for controlling the testing process to the standard output (stdout)

This function is designed to display interactive help for the testing framework's Command Line Interface (CLI). It lists all available flags for test filtering, logging state management, and execution mode control.

Detailed description

When called, the function prints the following command list to std::cout:

  • Execution Mode Flags: These flags determine the primary action of the test runner.
    • --test-run: Triggers the execution of the selected test suite.
    • --test-no-break: In case of an error, testing does not stop.
    • --test-list: Instead of running tests, the program outputs a hierarchical list of all registered tests (Part > Group > Test).
    • --test-help: Displays this help message and exits.
  • Filtering Flags (Inclusion): Used to narrow down the scope of execution. These flags can be used multiple times to combine filters.
    • --test-part [NAME]: Executes only tests belonging to the specified Part.
    • --test-group [NAME]: Executes only tests belonging to the specified Group.
    • --test-test [NAME]: Executes only the specific test with the given name.
  • Exclusion Flags (Ignore): Used to skip specific tests, groups, or parts even if they match the inclusion filters.
    • --test-ignore-part [NAME]: Skips all tests within the specified Part.
    • --test-ignore-group [NAME]: Skips all tests within the specified Group.
    • --test-ignore-test [NAME]: Skips the specific test by name.
  • Output Format: The framework supports an additional JUnit XML output format for integration with other automated testing systems.
    • --test-format [FORMAT]: Specifies the format of terminal output. By default, the format parameter can take only two values: default and junit. However, if user code declares additional output formats, they can also be specified.
  • File Output Management The test execution results can be written to a separate file with the desired format.
    • --test-file [FILE]: The test execution result will be written to the file. The file format is determined by the --test-format parameter. Default is "default".
    • --test-file-[FORMAT] [FILE]: Writes the test execution result to a file with the specified format. Example of writing in default format: test --test-file-default report.txt. Example of writing in junit format: test --test-file-junit report.xml
  • Logging Configuration:
    • --test-log-level [LEVEL]: Sets the verbosity of the built-in logger. Valid values are: off, ftl, err, wrn, att, log, inf, dbg, trc, all.

Example: Manual invocation in a custom menu

The function can be called directly to create your own management interface.

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> int main() { std::cout << "Welcome to Test Runner!" << std::endl; std::cout << "Type 'help' for options:" << std::endl; std::string input; while (std::cin >> input) { if (input == "help") { fcf::NTest::cmdHelp(); } } return 0; }

Output:

Welcome to Test Runner! Type 'help' for options: help Test options: --test-run - Run tests --test-list - Displays a list of all tests --test-part PART_NAME - Run only tests from the part. The parameter can be used multiple times --test-group GROUP_NAME - Run only tests from the group. The parameter can be used multiple times --test-test TEST_NAME - Run only this test. The parameter can be used multiple times --test-ignore-part PART_NAME - Exclude tests in the specified part(s). The parameter can be used multiple times --test-ignore-group GROUP_NAME - Exclude tests in the specified group(s). The parameter can be used multiple times --test-ignore-test TEST_NAME - Exclude the specified test(s). The parameter can be used multiple times --test-log-level LEVEL - Logging level (VALUES: def, off, ftl, err, wrn, att, log, inf, dbg, trc, all) --test-no-break - In case of an error, testing does not stop --test-format FORMAT - Output format (default, junit). --test-file FILE_PATH - Log file Use the default format or specify the --test-format parameter --test-file-default FILE_PATH - Log file (format: default). --test-file-junit FILE_PATH - Log file (format: junit). --test-help - Help message Explanatory details: 1. The --test-part, --test-group, --test-test commands are combined using the OR operation 2. The --test-ignore-part, --test-ignore-group, --test-ignore-test commands are combined using the OR operation