RobotTestingFramework
2.0.1
Robot Testing Framework
|
The TestSuite holds a group of tests. More...
#include <robottestingframework/TestSuite.h>
Public Member Functions | |
TestSuite (std::string name) | |
TestSuite constructor. More... | |
virtual | ~TestSuite () |
TestSuite destructor. More... | |
void | addTest (Test *test) |
Adding a new test. More... | |
void | removeTest (Test *test) |
Remove a test. More... | |
void | reset () |
Clear the test list. More... | |
void | addFixtureManager (FixtureManager *manager) |
addFixtureManager add a fixture manager for the current test suite. More... | |
void | fixtureCollapsed (TestMessage reason) override |
fixtureCollapsed is called by a fixture manager (if it is already setup) to inform the test suite that the corresponding fixture has been collapsed. More... | |
void | run (TestResult &rsl) override |
the main caller of a TestSuite inherited from Test Class. More... | |
void | interrupt () override |
interrupt interrupts the current test run More... | |
bool | succeeded () const override |
succeeded More... | |
TestResult * | getResult () |
getResult returns an instance of TestResult if run(TestResult &result) has been already called by a TestRunner More... | |
std::size_t | size () const |
returns the number of tests in this suite More... | |
![]() | |
Test (std::string name, std::string description="") | |
Test constructor. More... | |
virtual | ~Test () |
Test destructor. More... | |
const std::string | getName () const |
getName Getting test name. More... | |
const std::string | getDescription () const |
getDescription Getting test description More... | |
void | setDescription (const std::string description) |
setDescription Sets an optional string which describes the test. More... | |
Protected Member Functions | |
virtual bool | setup () |
setup is called before the test run More... | |
virtual void | tearDown () |
tearDown is called after the test run More... | |
![]() | |
void | setName (std::string name) |
setName setting the test name More... | |
Private Types | |
typedef std::vector< Test * > | TestContainer |
typedef std::vector< Test * >::iterator | TestIterator |
typedef std::vector< FixtureManager * > | FixtureContainer |
typedef std::vector< FixtureManager * >::iterator | FixtureIterator |
typedef std::vector< FixtureManager * >::reverse_iterator | FixtureRIterator |
Private Attributes | |
Test * | current |
TestResult * | result |
bool | successful |
bool | fixtureOK |
bool | interrupted |
TestMessage | fixtureMessage |
FixtureContainer | fixtureManagers |
TestContainer | tests |
The TestSuite holds a group of tests.
When the run()
method of a TestSuite is called, it executes all its tests. A TestSuite can also has a FixtureManager. In this case, it calls the setup()
method of FixtureManager to setup any fixture which is required for the tests before executing the tests. After running all the tests, the tearDown()
method of the FixtureManager is called to tear down the fixture.
The fixtureCollapsed
method is used by a fixture manager to inform the test suite that the corresponding fixture has been collapsed. In this case, an exception is thrown by the TestSuite and the remaining tests will not be executed any more. This method can be also overriden by a subclass if any specific action is required to be taken (such as retrying to setup the fixture and runing the reamining tests) upon collapsing the fixture.
Here's an example of using a TestSuite:
Definition at line 52 of file TestSuite.h.
|
private |
Definition at line 59 of file TestSuite.h.
|
private |
Definition at line 60 of file TestSuite.h.
|
private |
Definition at line 61 of file TestSuite.h.
|
private |
Definition at line 57 of file TestSuite.h.
|
private |
Definition at line 58 of file TestSuite.h.
robottestingframework::TestSuite::TestSuite | ( | std::string | name | ) |
|
virtual |
TestSuite destructor.
void robottestingframework::TestSuite::addFixtureManager | ( | FixtureManager * | manager | ) |
addFixtureManager add a fixture manager for the current test suite.
manager | an instance of FixtureManager |
void robottestingframework::TestSuite::addTest | ( | Test * | test | ) |
Adding a new test.
test | pointer to a Test object |
|
overridevirtual |
fixtureCollapsed is called by a fixture manager (if it is already setup) to inform the test suite that the corresponding fixture has been collapsed.
reason | An error message indicates the reason for collapsing the fixture. |
Implements robottestingframework::FixtureEvents.
TestResult* robottestingframework::TestSuite::getResult | ( | ) |
getResult returns an instance of TestResult if run(TestResult &result) has been already called by a TestRunner
|
overridevirtual |
interrupt interrupts the current test run
Reimplemented from robottestingframework::Test.
void robottestingframework::TestSuite::removeTest | ( | Test * | test | ) |
Remove a test.
test | pointer to a Test object |
void robottestingframework::TestSuite::reset | ( | ) |
Clear the test list.
|
overridevirtual |
the main caller of a TestSuite inherited from Test Class.
result | an instance of a TestResult to collect the result of the test. |
Implements robottestingframework::Test.
|
protectedvirtual |
setup is called before the test run
std::size_t robottestingframework::TestSuite::size | ( | ) | const |
returns the number of tests in this suite
|
overridevirtual |
succeeded
Implements robottestingframework::Test.
|
protectedvirtual |
tearDown is called after the test run
|
private |
Definition at line 154 of file TestSuite.h.
|
private |
Definition at line 160 of file TestSuite.h.
|
private |
Definition at line 159 of file TestSuite.h.
|
private |
Definition at line 157 of file TestSuite.h.
|
private |
Definition at line 158 of file TestSuite.h.
|
private |
Definition at line 155 of file TestSuite.h.
|
private |
Definition at line 156 of file TestSuite.h.
|
private |
Definition at line 161 of file TestSuite.h.