|
libwreport
3.5
|
Test case collecting several test methods, and self-registering with the singleton instance of TestRegistry. More...
#include <tests.h>
Public Member Functions | |
| TestCase (const std::string &name) | |
| virtual void | register_tests ()=0 |
| This will be called before running the test case, to populate it with its test methods. More... | |
| virtual void | setup () |
| Set up the test case before it is run. | |
| virtual void | teardown () |
| Clean up after the test case is run. | |
| virtual void | method_setup (TestMethodResult &) |
| Set up before the test method is run. | |
| virtual void | method_teardown (TestMethodResult &) |
| Clean up after the test method is run. | |
| virtual TestCaseResult | run_tests (TestController &controller) |
| Call setup(), run all the tests that have been registered, then call teardown(). More... | |
| virtual TestMethodResult | run_test (TestController &controller, TestMethod &method) |
| Run a test method. More... | |
| template<typename... Args> | |
| void | add_method (const std::string &name, std::function< void()> test_function) |
| Register a new test method. | |
| template<typename... Args> | |
| void | add_method (const std::string &name, std::function< void()> test_function, Args &&...args) |
| Register a new test method. | |
| template<typename FUNC , typename... Args> | |
| void | add_method (const std::string &name, FUNC test_function, Args &&...args) |
| Register a new test metheod, with arguments. More... | |
Data Fields | |
| std::string | name |
| Name of the test case. | |
| std::vector< TestMethod > | methods |
| All registered test methods. | |
Test case collecting several test methods, and self-registering with the singleton instance of TestRegistry.
|
inline |
Register a new test metheod, with arguments.
Any extra arguments to the function will be passed to the test method.
|
pure virtual |
This will be called before running the test case, to populate it with its test methods.
This needs to be reimplemented with a function that will mostly be a sequence of calls to add_method().
|
virtual |
Run a test method.
Call method_setup(), run all the tests that have been registered, then call method_teardown().
Exceptions thrown by the test method are caught and reported in TestMethodResult.
Exceptions in method_setup() and method_teardown() are caught and reported in TestMethodResult.
|
virtual |
Call setup(), run all the tests that have been registered, then call teardown().
Exceptions in setup() and teardown() are caught and reported in TestCaseResult. Test are run using run_test().
1.8.9.1