Ask a Question

Soapui - Groovy continue loop

SOLVED
ptrindade
New Contributor

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

5 REPLIES 5
ChrisAdams
Community Leader

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.

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

KarelHusa
Regular Contributor

@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

 

Sorry, I realise I should have explained...  You have to change "The Step Name" in 

testRunner.gotoStepByName("The Step Name");

to the name of the step you want to jump to and you have to use the quotes.  E.g.

testRunner.gotoStepByName("Request 2");

Thank you @ChrisAdams  and @KarelHusa , indeed it worked considering both your inputs! 

cancel
Showing results for 
Search instead for 
Did you mean: