This example shows a simple way of using TestCase, TestResult and ConsoleListener.
#include <cstdio>
#include <iostream>
class MyTest : public TestCase
{
public:
MyTest() :
TestCase("MyTest")
{
}
bool setup(int argc, char** argv) override
{
return true;
}
void tearDown() override
{
}
void run() override
{
int a = 5;
int b = 3;
}
};
int main(int argc, char** argv)
{
ConsoleListener listener(true);
TestResultCollector collector;
TestResult result;
result.addListener(&listener);
result.addListener(&collector);
MyTest atest;
atest.TestCase::run(result);
return collector.failedCount();
}
#define ROBOTTESTINGFRAMEWORK_ASSERT_ERROR(message)
Assertion with throwing error exception.
#define ROBOTTESTINGFRAMEWORK_TEST_CHECK(condition, message)
ROBOTTESTINGFRAMEWORK_TEST_CHECK combines ROBOTTESTINGFRAMEWORK_TEST_REPORT and ROBOTTESTINGFRAMEWORK...
#define ROBOTTESTINGFRAMEWORK_TEST_FAIL_IF_FALSE(condition, message)
Conditional failure report.
#define ROBOTTESTINGFRAMEWORK_TEST_REPORT(message)
Reporting a message to the TestResult.
static std::string format(const char *msg,...)
format can be used to format data to in the same way that sprintf formats.