Loop Break
Comments
-
Dear Parasoft Team,
do you have any solution?
0 -
Hello,
You can use Test Flow Logic to break the execution loop.
At first define boolean variable in the TestSuite:
Then configure Test Flow Logic using "Whiile variable" type:
Set Maximum number of loops to prevent infinite loop. Note that in "do" section "Nothing" is selected. This section can be used to change while variable value in each loop (for boolean it can be negated, for integer - increased or decreased). In your case you would like to change it by yourself.
The last part is script which will change variable value when the condition is met:function f1(input, context){
if( "meet condition" ){
context.setValue("execute", false);
}
}Now the TestSuite will be executed until the condition is met or maximum number of loops is exceeded
0 -
Thank you
0 -
I am using the above mentioned script option , but it checks only first time. When my next row in excel runs, I am using certain logic check and updating the Boolean value , but it is not stopping the Execution.
0 -
You could have something like this:
Scenario - has "Tests run all sub-groups as part of this group" enabled - Data Sources - Table - Scenario - configured to execute conditionally with "execute" boolean. - Test 1 - Test 2 - Test 3 (etc.) - Extension Tool - runs script to set "execute"
This way, the nested "Scenario" only executes on the current row if the "execute" variable is "true". The Extension Tool would still run for each row but this would be handy if you wanted to only skip certain rows and not others.
Please also consider if what you really want is to abort the scenario if an error occurs. There is an "Abort scenario on" checkbox in the Test Suite options.
0