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

Controlling test execution via the command line

The fcfTest library provides a flexible system for test filtering and logging configuration using command-line arguments. This allows you to run only the necessary test groups, exclude problematic areas, or change the output verbosity without recompiling the code.

Main Operating Modes

The fcf::NTest::cmdRun function determines the program's behavior based on the passed flags. The main control modes are:

  • --test-run — forces the execution of selected tests.
  • --test-list — displays a list of all registered tests in the hierarchy (Part -> Group -> Test).
  • --test-help — displays help information regarding available parameters.
Filtering Parameters

Filtering works on the principle of inclusion or exclusion. Parameters can be used multiple times to combine conditions.

Parameter Description
--test-part NAME Run only tests belonging to the specified part.
--test-group NAME Run only tests belonging to the specified group.
--test-test NAME Run only a specific test by its name.
--test-ignore-part NAME Exclude the specified part from execution.
--test-ignore-group NAME Exclude the specified group from execution.
--test-ignore-test NAME Exclude a specific test from execution.
Logging Configuration

The --test-log-level LEVEL parameter sets the logger's sensitivity threshold. Messages with a level lower than the specified one will be ignored.

Available levels (from lowest to highest priority):

  • off — logging is disabled.
  • ftl — Fatal (critical errors).
  • err — Error (errors).
  • wrn — Warning (warnings).
  • att — Attention (notices).
  • log — Log (standard level, default).
  • inf — Info (information).
  • dbg — Debug (debugging).
  • trc — Trace (tracing).
  • all — All levels.
  • def — Uses the application's default logging level (which is log by default).
Usage Examples

1. Running a specific test group with extended logging:

./my_tests --test-run --test-group Math --test-log-level dbg

2. Running all tests except for the "Integration" part and the "Legacy" group:

./my_tests --test-run --test-ignore-part Integration --test-ignore-group Legacy

3. Viewing the list of all available tests:

./my_tests --test-list

4. Running one specific test:

./my_tests --test-run --test-test VectorSizeCheck