1

I am trying to transfer the execution flow to another step in SOAPUI using groovy. I am using gotoStepByName but the execution is returning back to the next lines of code after execution.

I always assumed runTestStepByName will call the test step .. complete the execution and continue the remaining piece of code.

While gotoTestStepByName will actually go, execute that step and continue executing the next steps without coming back and executing the remaining piece of code.

if (json.size() == 0) {     
    testRunner.gotoStepByName( "DataSink")
    log.info "coming back here again"   
}

here I see the flow is actually coming back and printing 'coming back here again...'

How can I just transfer the flow of execution to another step from groovy without executing the rest of code and rest of steps before the transfer step.?

Any ideas?

mo0206
  • 791
  • 5
  • 20
  • 36
  • Can you please elaborate your use case? I was trying the same and realized after your question that it is not doing so like you pointed. May be there can be alternative if you mention the details of your case. – Rao Nov 23 '16 at 15:26
  • Okay SoapUI/ReadyAPI does not have any inbuilt method to perform that. Control will always come back. There are many workarounds which you should use. Explain your requirements maybe we can find a good workaround. – Kumar Sourav Nov 29 '16 at 07:38

1 Answers1

0

To transfer execution to other step (and skip any intermediate steps) you can use gotoStepByName

To stop execution of current Groovy Script you can use return statement


So the provided code from the question would look like following:

if (json.size() == 0) {     
    testRunner.gotoStepByName( "DataSink") // Transfer execution to other step
    return                                 // Stop execution of current script
    log.info "coming back here again"   
}
MrHant
  • 880
  • 6
  • 11