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 level management, and execution mode control.
Detailed description
When called, the function prints the following command list to
Execution Mode Flags: These flags determine the primary action of the test runner.--test-run: Triggers the execution of the selected test suite.--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.
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: Automatic invocation via fcf::NTest::cmdRun
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
int main(int argc, char* argv[]) {
bool error;
// If argv contains "--test-help", help will be displayed and the program will exit
fcf::NTest::cmdRun (argc, argv, fcf::NTest::CRM_RUN , &error);
return error ? 1 : 0;
}
Output:
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: off, ftl, err, wrn, att, log, inf, dbg, trc, all)
--test-help - Help message
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>
void printMenu() {
std::cout << "Welcome to Test Runner!" << std::endl;
std::cout << "Type 'help' for options:" << std::endl;
}
int main() {
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
... (parameter list continues)
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.