libwreport 3.38
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)
 
 FixtureTestCase (const FixtureTestCase &)=delete
 
 FixtureTestCase (FixtureTestCase &&)=delete
 
FixtureTestCaseoperator= (const FixtureTestCase &)=delete
 
FixtureTestCaseoperator= (FixtureTestCase &)=delete
 
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 ... Args>
TestMethodadd_method (const std::string &name_, std::function< void(FIXTURE &)> test_function)
 Register a new test method that takes a reference to the fixture as argument.
 
template<typename ... Args>
TestMethodadd_method (const std::string &name_, const std::string &doc, std::function< void(FIXTURE &)> test_function)
 Register a new test method that takes a reference to the fixture as argument, including documentation.
 
- Public Member Functions inherited from wreport::tests::TestCase
 TestCase (const std::string &name)
 
void register_tests_once ()
 Idempotent wrapper for register_tests()
 
virtual void register_tests ()=0
 This will be called before running the test case, to populate it with its test methods.
 
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.
 
TestMethodadd_method (const std::string &name_)
 Register a new test method, with the actual test function to be added later.
 
template<typename ... Args>
TestMethodadd_method (const std::string &name_, std::function< void()> test_function)
 Register a new test method.
 
template<typename ... Args>
TestMethodadd_method (const std::string &name_, const std::string &doc, std::function< void()> test_function)
 Register a new test method, including documentation.
 

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.
 
bool tests_registered = false
 Set to true the first time register_tests_once is run.
 

Detailed Description

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

Test case that includes a fixture.

Member Function Documentation

◆ method_setup()

template<typename FIXTURE>
void wreport::tests::FixtureTestCase< FIXTURE >::method_setup ( TestMethodResult & )
inlineoverridevirtual

Set up before the test method is run.

Reimplemented from wreport::tests::TestCase.

References wreport::tests::TestCase::method_setup().

◆ method_teardown()

template<typename FIXTURE>
void wreport::tests::FixtureTestCase< FIXTURE >::method_teardown ( TestMethodResult & )
inlineoverridevirtual

Clean up after the test method is run.

Reimplemented from wreport::tests::TestCase.

References wreport::tests::TestCase::method_teardown().

◆ setup()

template<typename FIXTURE>
void wreport::tests::FixtureTestCase< FIXTURE >::setup ( )
inlineoverridevirtual

Set up the test case before it is run.

Reimplemented from wreport::tests::TestCase.

References wreport::tests::TestCase::setup().

◆ teardown()

template<typename FIXTURE>
void wreport::tests::FixtureTestCase< FIXTURE >::teardown ( )
inlineoverridevirtual

Clean up after the test case is run.

Reimplemented from wreport::tests::TestCase.

References wreport::tests::TestCase::teardown().


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