|
libept
|
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 | ~TestCase () |
| virtual void | register_tests ()=0 |
| This will be called before running the test case, to populate it with its test methods. | |
| 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(). | |
| virtual TestMethodResult | run_test (TestController &controller, TestMethod &method) |
| Run a test method. | |
| 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. | |
Public Attributes | |
| 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 |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
Set up before the test method is run.
Reimplemented in ept::tests::FixtureTestCase< FIXTURE >.
Referenced by ept::tests::FixtureTestCase< FIXTURE >::method_setup(), and run_test().
|
inlinevirtual |
Clean up after the test method is run.
Reimplemented in ept::tests::FixtureTestCase< FIXTURE >.
Referenced by ept::tests::FixtureTestCase< FIXTURE >::method_teardown(), and run_test().
|
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().
Referenced by register_tests().
|
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.
References method_setup(), method_teardown(), ept::tests::TestMethod::name, name, res, ept::tests::TestMethod::test_function, ept::tests::TestController::test_method_begin(), and ept::tests::TestController::test_method_end().
Referenced by run_tests().
|
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().
References methods, name, res, run_test(), setup(), teardown(), ept::tests::TestController::test_case_begin(), and ept::tests::TestController::test_case_end().
|
inlinevirtual |
Set up the test case before it is run.
Reimplemented in ept::tests::FixtureTestCase< FIXTURE >.
Referenced by run_tests(), and ept::tests::FixtureTestCase< FIXTURE >::setup().
|
inlinevirtual |
Clean up after the test case is run.
Reimplemented in ept::tests::FixtureTestCase< FIXTURE >.
Referenced by run_tests(), and ept::tests::FixtureTestCase< FIXTURE >::teardown().
| std::vector<TestMethod> ept::tests::TestCase::methods |
All registered test methods.
Referenced by add_method(), ept::tests::FixtureTestCase< FIXTURE >::add_method(), add_method(), add_method(), run_tests(), and ept::tests::SimpleTestController::test_case_begin().
| std::string ept::tests::TestCase::name |
Name of the test case.
Referenced by add_method(), ept::tests::FixtureTestCase< FIXTURE >::add_method(), add_method(), add_method(), run_test(), run_tests(), and ept::tests::SimpleTestController::test_case_begin().