Test Suites
Test suites are named groups of related test cases. More...
Classes Index
| class | static_suite |
|
A test suite designed for static (namespace-scope) registration with a static_runner. More... | |
| class | suite |
|
A named, runnable test suite registered with the test runner. More... | |
Description
Test suites are named groups of related test cases.
By default, all test cases defined in main() are included in the top-level test suite, which is created by runner::initialise() and executed immediately. For more complex projects, additional test suites can be defined, typically in separate source files.
Stand-alone test suites are implemented as mt::static_suite objects, constructed with a name, a reference to the runner, and a callable (usually a lambda that chains execution of test cases), along with any optional arguments. This design enables self-registration of test suites, ensuring they are automatically included in the test run.
It is strongly recommended to instantiate additional test suites as static objects so that their constructors are invoked before main() begins.
Self-registration is performed within the constructor, ensuring that each test suite is automatically included in the test run. When test suites are defined in separate compilation units, they can be executed in any order, as the sequence in which static constructors are invoked is not specified. Consequently, test suites should be designed to be independent and must not rely on the execution order of other suites.
All registered test suites are executed when runner::exit_code() is called, guaranteeing comprehensive test coverage across the project.
- Examples
Generated via doxygen2docusaurus 2.2.0 by Doxygen 1.17.0.