This class defines the API for the created TestConditions.
#include <configitemtestobject.h>
◆ getCallback
Retrieves the TestCallback.
The test callback is called, if the test condition changes its state to PASSED, FAILED or TIMEOUT.
- Returns
- TestCallback
◆ getCapturedText
QString getCapturedText |
( |
| ) |
|
|
slot |
Retrieves the captured text. Example:
var test0 = to.createTest("test0");
test0.setCallback("test0Callback");
function test0Callback(TestIndex)
{
trace("test0Callback(" + TestIndex + ")");
var t = to.getTest(TestIndex);
var captured = t.getCapturedText();
}
- Returns
- The captured text
◆ getState
Retrieves the state of the TestCondition.
Possible values are: TEST_INACTIVE = 0, TEST_ACTIVE = 1, TEST_RUNNING = 2, TEST_PAUSED = 3, TEST_PASSED = 4, TEST_FAILED = 5, TEST_DELAYED = 6, TEST_TIMEOUT = 7, TEST_CANCELED = 8, TEST_CANCELEDBYPARENT = 9, TEST_ERROR = 10
Example:
var test0 = to.createTest("test0");
var cond0 = test0.createCondition(0, "cond0");
cond0.setCallback("cond0Callback");
function cond0Callback(TestIndex, ConditionIndex)
{
var t = to.getTest(TestIndex);
var c = t.getCondition(ConditionIndex);
var state = c.getState();
}
- Returns
- The state of the condition
◆ getTime
◆ setCallback
Sets the TestCallback.
The test callback is called, if the test condition changes its state to PASSED, FAILED or TIMEOUT. Example:
var test0 = to.createTest("test0");
var cond0 = test0.createCondition(0, "cond0");
cond0.setCallback("cond0Callback");
function cond0Callback(TestIndex, ConditionIndex)
{
var t = to.getTest(TestIndex);
var c = t.getCondition(ConditionIndex);
var captured = c.getCapturedText();
}
- Parameters
-
- Returns
- The TestCondition handle.
◆ setExpression
TestCondition * setExpression |
( |
QString | strPassed, |
|
|
QString | strFailed = "" ) |
|
slot |
Sets the passed and failed regular expressions of the TestCondition. Example:
var test0 = to.createTest("test0");
var cond0 = test0.createCondition(0, "cond0");
function anyFunction()
{
cond0.setExpression("passedRegExp.*", "failedRegExp.*");
}
- Parameters
-
- Returns
- The TestCondition handle.
◆ setFaultTolerance
Sets the fault tolerance of the test condition. That means, if true, the test condition is able to fail, bit will not cancel the test immediately. The test is continuing to check the other conditions. If false, the test is changing it's state to failed and informs its parent.
Example:
var invisibleTest0 = to.createInvisibleTest("invisibleTest0", "invisibleTestFunction");
invisibleTest0.createCondition(0, "condition", "passed", "failed").setFaultTolerance(true);
- Parameters
-
bFaultTolerant | Set to true, if the TestCondition shall be fault tolerant. |
- Returns
- The TestCondition handle.
◆ setState
Sets the state of the TestCondition.
Example:
var test0 = to.createTest("test0", "test0Function");
var cond0 = test0.createCondition(0, "myCondition");
cond0.setState(true, "passed because of ...");
cond0.setState(false, "failed because of ...");
- Parameters
-
bPassed | True to set the state to passed, false for failed state. |
strMessage | The text is shown in the test report when the test run is finished. |
- Returns
- The TestCondition handle.
◆ setWatchdogExpression