Loop Break

rvmsengrvmseng Posts: 52

Hi Dears,

I have a question.
How can I break test execution loop?

for example I create a loop on suit A, and I write a script in Suite A, when I meet exit condition I want to break Loop.

Comments

  • rvmsengrvmseng Posts: 52

    Dear Parasoft Team,

    do you have any solution?

  • KrzysztofMarczykKrzysztofMarczyk Posts: 6

    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

  • rvmsengrvmseng Posts: 52

    Thank you

Sign In or Register to comment.