Waiting for the Expected Result

It is sometimes needed for a test to wait for an attribute to change its value, or for an operation to return a specific result. To solve this common problem, you can use the Action::waitForExpr attribute setting its value to the maximum time provtest should wait for the expected before forcing the status of the test to "FAILED".

The following example invokes the operation "getCycleResult" on the object "getSo" and says that the action should wait at maximum 20 seconds for this operation to return the value "4".

<test name="test_action_waitForExpr_1">
<flow>flow1</flow>
<description>Test action : attribute waitForSucess (1)</description>
<action waitForExpr="20">
<invoke object="getSo" operation="getCycleResult">
<return value="4"/>
</invoke>
</action>
</test>

If the action is synchronous (which is the case here), no further action is executed while this action did end in the expected result. Notice that the object "getSo" is not write-locked for ever : the transaction is broken when setting waitForExpr.