The FixtureManager can be used to to setup any fixture which is required for the tests before executing the tests by a TestSuite.
More...
#include <robottestingframework/FixtureManager.h>
The FixtureManager can be used to to setup any fixture which is required for the tests before executing the tests by a TestSuite.
The fixtureCollapsed
method of the FixtureEvents class is used by a fixture manager to inform any class which inherited from FixtureEvents that the corresponding fixture has been collapsed.
Here's an example of using a FixtureManager:
#include <cstdio>
{
public:
MyTest1() :
{
}
void run() override
{
}
};
{
public:
MyTest2() :
{
}
void run() override
{
}
};
{
public:
{
}
bool setup(
int argc,
char** argv)
override {
printf("Myfixture setup!\n");
return true;
}
{
printf("Myfixture checking ...\n");
return true;
}
{
printf("Myfixture tear down!\n");
}
};
int main(int argc, char** argv)
{
MyFixture fixture(&suite);
suite.addFixtureManager(&fixture);
MyTest1 test1;
MyTest2 test2;
suite.addTest(&test1);
suite.addTest(&test2);
}
- Examples:
- simple_fixture.cpp.
Definition at line 63 of file FixtureManager.h.
◆ FixtureManager() [1/2]
robottestingframework::FixtureManager::FixtureManager |
( |
std::string |
param = "" | ) |
|
FixtureManager constructor The parameter string is parsed into (argc/argv) format and will be passed to the fixture manager using setup(int argc, char** argv).
- Parameters
-
param | fixture manager optional parameters |
◆ FixtureManager() [2/2]
robottestingframework::FixtureManager::FixtureManager |
( |
FixtureEvents * |
dispatcher, |
|
|
std::string |
param = "" |
|
) |
| |
◆ ~FixtureManager()
virtual robottestingframework::FixtureManager::~FixtureManager |
( |
| ) |
|
|
virtual |
◆ check()
virtual bool robottestingframework::FixtureManager::check |
( |
| ) |
|
|
virtual |
check if the fixture is okay.
This is called automatically from the corresponding test suite to ensure the correctness of the fixture before running each test case.
- Returns
- true or false depending of correctness of the fixture
◆ getDispatcher()
FixtureEvents* robottestingframework::FixtureManager::getDispatcher |
( |
| ) |
|
◆ getParam()
std::string robottestingframework::FixtureManager::getParam |
( |
| ) |
|
getParam gets the original parameter string which is set for the fixture manager
- Returns
- a string parameter
◆ setDispatcher()
void robottestingframework::FixtureManager::setDispatcher |
( |
FixtureEvents * |
dispatcher | ) |
|
◆ setParam()
void robottestingframework::FixtureManager::setParam |
( |
const std::string |
param | ) |
|
setParam Sets the optional parameters of the fixture manager.
The parameter string is parsed into (argc/argv) format and will be passed to the fixture manager using setup(int argc, char** argv).
- Parameters
-
param | the parameter string |
◆ setup() [1/2]
bool robottestingframework::FixtureManager::setup |
( |
| ) |
|
setup is called by a test suite.
The setup() function parses the fixture paramteres and call the setup(int argc, char**argv) which can be ovveriden by the user customized fixture manager.
- Returns
- true or false depending of the test initialization
◆ setup() [2/2]
virtual bool robottestingframework::FixtureManager::setup |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
|
virtual |
setup is called to start the fixture manager
- Parameters
-
argc | The number of the pasred argument from string parameter |
argv | The arguments which is parsed using string parameter |
- Returns
- true or false depending of the fixture initialization
◆ tearDown()
virtual void robottestingframework::FixtureManager::tearDown |
( |
| ) |
|
|
virtual |
tearDown is called after to stop the fixture manager
◆ dispatcher
◆ param
std::string robottestingframework::FixtureManager::param |
|
private |
The documentation for this class was generated from the following file: