Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Loop Break

Options
rvmseng
rvmseng Posts: 89

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

  • rvmseng
    rvmseng Posts: 89
    Options

    Dear Parasoft Team,

    do you have any solution?

  • KrzysztofMarczyk
    Options

    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

  • rvmseng
    rvmseng Posts: 89
    Options

    Thank you