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;
}
bool check() override
{
printf("Myfixture checking ...\n");
return true;
}
void tearDown() override
{
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);
}
#define ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE(condition, message)
Conditional failure report.
#define ROBOTTESTINGFRAMEWORK_TEST_REPORT(message)
Reporting a message to the TestResult.
class ConsoleListener listens to any messages reported by the tests during the test run,...
The FixtureException class Ficture exception is used when a there is a probleme during fixture setup.
The FixtureManager can be used to to setup any fixture which is required for the tests before executi...
The base class to implememnt a test case.
A formated message with details.
The TestResultCollector class can be used to store all the events issued by the test cases,...
unsigned int failedCount()
failedCount gets the number of failed test cases.
The TestResult class is used to deliver the test results including any error and failures produced by...
void addListener(TestListener *listener)
Adding a new listener.
The TestRunner class runs the tests added as TestCase or TestSuite.
void run(TestResult &result)
Run all the tests in the list.
void addTest(Test *test)
Adding a new test.
The TestSuite holds a group of tests.
- 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: