libwreport  3.6
Public Types | Public Member Functions | Data Fields
wreport::tests::FixtureTestCase< FIXTURE > Class Template Reference

Test case that includes a fixture. More...

#include <tests.h>

Inheritance diagram for wreport::tests::FixtureTestCase< FIXTURE >:
wreport::tests::TestCase

Public Types

typedef FIXTURE Fixture
 

Public Member Functions

template<typename... Args>
 FixtureTestCase (const std::string &name, Args...args)
 
void setup () override
 Set up the test case before it is run.
 
void teardown () override
 Clean up after the test case is run.
 
void method_setup (TestMethodResult &mr) override
 Set up before the test method is run.
 
void method_teardown (TestMethodResult &mr) override
 Clean up after the test method is run.
 
template<typename FUNC >
void add_method (const std::string &name, FUNC test_function)
 Add a method that takes a reference to the fixture as argument. More...
 
- Public Member Functions inherited from wreport::tests::TestCase
 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 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

Fixture * fixture = nullptr
 
std::function< Fixture *()> make_fixture
 
- Data Fields inherited from wreport::tests::TestCase
std::string name
 Name of the test case.
 
std::vector< TestMethodmethods
 All registered test methods.
 

Detailed Description

template<typename FIXTURE>
class wreport::tests::FixtureTestCase< FIXTURE >

Test case that includes a fixture.

Member Function Documentation

template<typename FIXTURE >
template<typename FUNC >
void wreport::tests::FixtureTestCase< FIXTURE >::add_method ( const std::string &  name,
FUNC  test_function 
)
inline

Add a method that takes a reference to the fixture as argument.

Any extra arguments to the function will be passed to the test method after the fixture.


The documentation for this class was generated from the following file: