1
votes

I am required to cancel a specific TestStep (SoapRequest) in TestCase depending on condition. So I decided to create Groovy Script.

import com.eviware.soapui.impl.wsdl.teststeps.*;

String  inMoney = context.expand( '${#Project#Money}' );
def step =  testRunner.getTestCase().getTestStepByName("creditMoney");
log.info "step: $step";
if ((inMoney == '0') && (step instanceof WsdlTestRequestStep ) &&  (step != null)) 
step.cancel();

But this code doesn't cancel the test step instead returns always 'false'. If that was the last TestStep in TestCase, I could just call testRunner.cancel(), and it would work. But in my case this is not an option. Does somedody have ideas to figure out this problem? Thanks.

1
a simple google search have me this link soapui.org/forum/viewtopic.php?f=2&t=4576 did this not work for you? - Abhishek Asthana

1 Answers

0
votes

To control test execution flow you can use "Conditional Goto" test step (the easiest way) or "Groovy script" test step if you need more complex logic.

Detailed instructions here: http://www.soapui.org/Functional-Testing/controlling-flow.html

If you decide to use groovy script and you need to cancel not the last step, you can just run next step by name in groovy script:

testRunner.runTestStepByName( "next_step_name")