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. More... | |
virtual void | setup () |
Set up the test case before it is run. More... | |
virtual void | teardown () |
Clean up after the test case is run. More... | |
virtual void | method_setup (TestMethodResult &) |
Set up before the test method is run. More... | |
virtual void | method_teardown (TestMethodResult &) |
Clean up after the test method is run. More... | |
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. More... | |
template<typename ... Args> | |
void | add_method (const std::string &name, std::function< void()> test_function, Args &&... args) |
Register a new test method. More... | |
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... | |
Public Attributes | |
std::string | name |
Name of the test case. More... | |
std::vector< TestMethod > | methods |
All registered test methods. More... | |
Test case collecting several test methods, and self-registering with the singleton instance of TestRegistry.
|
inline |
References ept::tests::TestRegistry::get(), and ept::tests::TestRegistry::register_test_case().
Referenced by register_tests().
|
inlinevirtual |
References register_tests().
|
inline |
Register a new test method.
|
inline |
Register a new test method.
|
inline |
Register a new test metheod, with arguments.
Any extra arguments to the function will be passed to the test method.
|
inlinevirtual |
Set up before the test method is run.
Reimplemented in ept::tests::FixtureTestCase< FIXTURE >.
Referenced by ept::tests::FixtureTestCase< FIXTURE >::method_setup().
|
inlinevirtual |
Clean up after the test method is run.
Reimplemented in ept::tests::FixtureTestCase< FIXTURE >.
Referenced by ept::tests::FixtureTestCase< FIXTURE >::method_teardown().
|
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.
References ept::tests::TestMethod::name, res, ept::tests::TestMethodResult::set_exception(), ept::tests::TestMethodResult::set_failed(), ept::tests::TestMethodResult::set_setup_exception(), ept::tests::TestMethodResult::set_teardown_exception(), ept::tests::TestMethodResult::set_unknown_exception(), ept::tests::TestMethodResult::skipped, ept::tests::TestMethod::test_function, ept::tests::TestController::test_method_begin(), and ept::tests::TestController::test_method_end().
|
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 ept::tests::TestCaseResult::add_test_method(), res, ept::tests::TestCaseResult::set_setup_failed(), ept::tests::TestCaseResult::set_teardown_failed(), ept::tests::TestCaseResult::skipped, 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 ept::tests::FixtureTestCase< FIXTURE >::setup().
|
inlinevirtual |
Clean up after the test case is run.
Reimplemented in ept::tests::FixtureTestCase< FIXTURE >.
Referenced by ept::tests::FixtureTestCase< FIXTURE >::teardown().
std::vector<TestMethod> ept::tests::TestCase::methods |
All registered test methods.
Referenced by ept::tests::SimpleTestController::test_case_begin().
std::string ept::tests::TestCase::name |
Name of the test case.
Referenced by ept::tests::SimpleTestController::test_case_begin().