kbLogger 2.0.b1
The automotive ready test and logging program.
TestCondition Class Reference

This class defines the API for the created TestConditions.

#include <configitemtestobject.h>

Public Slots

Test related functions.
QString getCallback ()
 Retrieves the test callback.
 
TestConditionsetCallback (QString strTestCallback)
 Sets the test callback.
 
int getState ()
 Retrieves the state of the TestCondition.
 
TestConditionsetState (bool bPassed, QString strMessage)
 Sets the state of the TestCondition.
 
quint32 getTime ()
 Retrieves the runtime of the TestCondition.
 
QString getCapturedText ()
 Retrieves the captured text.
 
TestConditionsetExpression (QString strPassed, QString strFailed="")
 Sets the passed and failed regular expressions of the TestCondition.
 
TestConditionsetWatchdogExpression (QString strWatchdog)
 Sets the watchdog regular expression of the TestCondition.
 
TestConditionsetFaultTolerance (bool bFaultTolerant)
 Activate or deactivates the fault tolerant mode.
 

Member Function Documentation

◆ getCallback

QString getCallback ( )
slot

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"); // Create a test
test0.setCallback("test0Callback"); // Add a test callback
function test0Callback(TestIndex)
{
trace("test0Callback(" + TestIndex + ")");
var t = to.getTest(TestIndex);
var captured = t.getCapturedText();
}
Returns
The captured text

◆ getState

int getState ( )
slot

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"); // Create a test
var cond0 = test0.createCondition(0, "cond0");
cond0.setCallback("cond0Callback"); // Add a test callback
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

quint32 getTime ( )
slot

Retrieves the runtime of the TestCondition.

Returns

◆ setCallback

TestCondition * setCallback ( QString strTestCallback)
slot

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"); // Create a test
var cond0 = test0.createCondition(0, "cond0");
cond0.setCallback("cond0Callback"); // Add a test callback
function cond0Callback(TestIndex, ConditionIndex)
{
var t = to.getTest(TestIndex);
var c = t.getCondition(ConditionIndex);
var captured = c.getCapturedText();
}
Parameters
strTestCallback
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"); // Create a test
var cond0 = test0.createCondition(0, "cond0");
function anyFunction()
{
cond0.setExpression("passedRegExp.*", "failedRegExp.*");
}
Parameters
strPassed
strFailed
Returns
The TestCondition handle.

◆ setFaultTolerance

TestCondition * setFaultTolerance ( bool bFaultTolerant)
slot

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"); // Create an invisible test
invisibleTest0.createCondition(0, "condition", "passed", "failed").setFaultTolerance(true);
Parameters
bFaultTolerantSet to true, if the TestCondition shall be fault tolerant.
Returns
The TestCondition handle.

◆ setState

TestCondition * setState ( bool bPassed,
QString strMessage )
slot

Sets the state of the TestCondition.

Example:

var test0 = to.createTest("test0", "test0Function"); // Create a test
var cond0 = test0.createCondition(0, "myCondition"); // Add a condition
cond0.setState(true, "passed because of ..."); // Set the condition to passed
cond0.setState(false, "failed because of ..."); // Set the condition to failed
Parameters
bPassedTrue to set the state to passed, false for failed state.
strMessageThe text is shown in the test report when the test run is finished.
Returns
The TestCondition handle.

◆ setWatchdogExpression

TestCondition * setWatchdogExpression ( QString strWatchdog)
slot

Sets the watchdog regular expression of the TestCondition.

Parameters
strWatchdog
Returns
The TestCondition handle.