RobotTestingFramework  2.0.1
Robot Testing Framework
Static Public Member Functions | List of all members
robottestingframework::Asserter Class Reference

The Asserter class is used to throw exception or to report messages/failures to a TestResult. More...

#include <robottestingframework/Asserter.h>

Static Public Member Functions

static ROBOTTESTINGFRAMEWORK_NORETURN void fail (TestMessage msg)
 fail Throw a failure exception with the given message. More...
 
static void fail (bool condition, TestMessage msg)
 fail Throw a failure exception if the condition is not hold (it is not true). More...
 
static ROBOTTESTINGFRAMEWORK_NORETURN void error (TestMessage msg)
 error Throw an error exception with the given message. More...
 
static void error (bool condition, TestMessage msg)
 error Throw an error exception if the condition is not hold (it is not true). More...
 
static void report (TestMessage msg, TestSuite *testsuite)
 report report a message to the result collector of the given TestSuite More...
 
static void report (TestMessage msg, TestCase *testcase)
 report report a message to the result collector of the given TestCase More...
 
static void testFail (bool condition, TestMessage msg, TestCase *testcase)
 Checks the given boolean condition and if it is not hold (it is not true) a failure message will be added to the result collector. More...
 
static void testCheck (bool condition, TestMessage msg, TestCase *testcase)
 Checks the given boolean condition and if it is not hold (it is not true) a failure message will be added to the result collector; otherwise only the message will be reported. More...
 
static std::string format (const char *msg,...)
 format can be used to format data to in the same way that sprintf formats. More...
 

Detailed Description

The Asserter class is used to throw exception or to report messages/failures to a TestResult.

Note
There are many usefull macros in the TestAssert.h which can be used to prepare detailed messages of errors or test failures.

Definition at line 47 of file Asserter.h.

Member Function Documentation

◆ error() [1/2]

static ROBOTTESTINGFRAMEWORK_NORETURN void robottestingframework::Asserter::error ( TestMessage  msg)
static

error Throw an error exception with the given message.

Parameters
msgThe corresponding error message

◆ error() [2/2]

static void robottestingframework::Asserter::error ( bool  condition,
TestMessage  msg 
)
static

error Throw an error exception if the condition is not hold (it is not true).

Parameters
conditionThe boolean expression
msgThe corresponding error message

◆ fail() [1/2]

static ROBOTTESTINGFRAMEWORK_NORETURN void robottestingframework::Asserter::fail ( TestMessage  msg)
static

fail Throw a failure exception with the given message.

Parameters
msgThe corresponding failure message

◆ fail() [2/2]

static void robottestingframework::Asserter::fail ( bool  condition,
TestMessage  msg 
)
static

fail Throw a failure exception if the condition is not hold (it is not true).

Parameters
conditionThe boolean expression
msgThe corresponding failure message

◆ format()

static std::string robottestingframework::Asserter::format ( const char *  msg,
  ... 
)
static

format can be used to format data to in the same way that sprintf formats.

Parameters
msga format-control string
Returns
the formated std::string
Examples:
simple.cpp.

◆ report() [1/2]

static void robottestingframework::Asserter::report ( TestMessage  msg,
TestSuite testsuite 
)
static

report report a message to the result collector of the given TestSuite

Parameters
msgThe corresponding message
testsuiteThe owner of the message (reporter)
Note
report does not throw any exception!

◆ report() [2/2]

static void robottestingframework::Asserter::report ( TestMessage  msg,
TestCase testcase 
)
static

report report a message to the result collector of the given TestCase

Parameters
msgThe corresponding message
testcaseThe owner of the message (reporter)
Note
report does not throw any exception!

◆ testCheck()

static void robottestingframework::Asserter::testCheck ( bool  condition,
TestMessage  msg,
TestCase testcase 
)
static

Checks the given boolean condition and if it is not hold (it is not true) a failure message will be added to the result collector; otherwise only the message will be reported.

Parameters
conditionThe boolean expression
msgThe corresponding message
testcaseThe owner of the message (reporter)
Note
This does not throw any exception!

◆ testFail()

static void robottestingframework::Asserter::testFail ( bool  condition,
TestMessage  msg,
TestCase testcase 
)
static

Checks the given boolean condition and if it is not hold (it is not true) a failure message will be added to the result collector.

Parameters
conditionThe boolean expression
msgThe corresponding message
testcaseThe owner of the message (reporter)
Note
This does not throw any exception!

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