Forum Discussion

ptrindade's avatar
ptrindade
Occasional Contributor
3 years ago

Soapui - Groovy continue loop

Hello!

 

Trying to implement something like this cycle:

DataSource

Request 1

- if response has property x = 1 , go to request 2 and continue loop flow

- if response has property x = 2,  go to request 3 and continue loop flow

request 2

request 3

validate DB

Datasink

DataSource Loop

 

as:

 

def responseAsXml = context.expand( '${GET BD Valida Credito Servico - para POSPAGO, Empresarial, NOVA QUERY#ResponseAsXml#//Results[1]/ResultSet[1]/Row[2]/AUTOSUBS[1]}' )

 

if (responseAsXml == ("NAO")) {
testRunner.runTestStepByName("GET WS Subscricao")
}
else if (responseAsXml == ("SIM")){
testRunner.runTestStepByName("GET BD Subscricao")
}

 

------------------

 

My problem is that the loop brakes when executes "testRunner.runTestStepByName", doesnt execute the next step of the loop flow ..

Thank you in advance for any help you may give me !

 

pedro

  • Hi

    Try....

    testRunner.gotoStepByName("The Step Name");

    You may need some additional logic to not run Step3 if Step2 has ran, but with at above method, you should be able to work something out.

  • ptrindade ,

    I believe ChrisAdams 's suggestion should work.

     

    Please make sure you are executing the tests on the test case level. If you only execute a single step, the execution flow will not continue.

     

    Regards,

    Karel

     

  • ChrisAdams's avatar
    ChrisAdams
    Champion Level 3

    Hi

    Try....

    testRunner.gotoStepByName("The Step Name");

    You may need some additional logic to not run Step3 if Step2 has ran, but with at above method, you should be able to work something out.

    • ptrindade's avatar
      ptrindade
      Occasional Contributor

      It goes to ("The Step Name"), but stops there, doesn't run the next step from the flow...

      • KarelHusa's avatar
        KarelHusa
        Champion Level 1

        ptrindade ,

        I believe ChrisAdams 's suggestion should work.

         

        Please make sure you are executing the tests on the test case level. If you only execute a single step, the execution flow will not continue.

         

        Regards,

        Karel