The test_runner class is responsible for managing the registration and execution of test suites within the µTest++ framework. It maintains a collection of test suites, each of which registers itself automatically upon construction, enabling seamless integration and execution of tests across different components and folders of a project.
The test runner provides methods for initialising the test environment, registering test suites, retrieving the runner's name, and determining the overall test result via an exit code. It also offers an abort mechanism for terminating test execution in exceptional circumstances.
All members and methods are defined within the micro_os_plus::micro_test_plus namespace, ensuring clear separation from user code and minimising the risk of naming conflicts.
Definition at line 96 of file test-runner.h.
micro_os_plus::micro_test_plus::test_runner::test_runner |
( |
| ) |
|
The rule of five is enforced to prevent accidental copying or moving.
The constructor initialises a new instance of the test_runner class, preparing the test runner for managing test suites and cases within the µTest++ framework. If tracing is enabled, it outputs the function signature for diagnostic purposes. This setup ensures the test runner is ready to coordinate the registration, execution, and reporting of tests across all test cases and folders.
Definition at line 72 of file test-runner.cpp.
void micro_os_plus::micro_test_plus::test_runner::initialize |
( |
int | argc, |
|
|
char * | argv[], |
|
|
const char * | name ) |
- Parameters
-
argc | The argument count from main(). |
argv | The argument vector from main(). |
name | The name of the default test suite. |
- Returns
- Nothing.
This method initialises the test runner by capturing the command-line arguments and the default test suite name, configuring the framework for subsequent test execution. It parses the arguments to determine the desired verbosity level (normal, verbose, quiet, or silent) and applies this setting to the test reporter. The method also outputs build and environment information when appropriate, aiding diagnostics and transparency. Finally, it creates and registers the default test suite, preparing the framework to manage and execute all test cases and suites across the project’s folders.
Definition at line 96 of file test-runner.cpp.
void micro_os_plus::micro_test_plus::test_runner::register_test_suite |
( |
test_suite_base * | suite | ) |
|
- Parameters
-
suite | Pointer to the test suite to register. |
- Returns
- Nothing.
This method registers a new test suite with the test runner. If the internal collection of test suites has not yet been created, it is initialised at this point. The provided test suite is then added to the collection, enabling the framework to manage and execute multiple test suites across different files and folders within the project.
Called by test suite constructors to register themselves with the runner, enabling automatic management and execution.
Definition at line 232 of file test-runner.cpp.