Forum Discussion

PeterKlim's avatar
PeterKlim
Contributor
11 years ago

Skipping test steps by using Groovy step

 would like to skip some steps if a certain previous test fails or if the step has a particular response. How do I do that?

 

For instance, this is the order of my test steps:

 

HTTPrequestA
GroovyStep
HTTPrequestB
HTTPrequestC
HTTPrequestD

 


GroovyStep has this pseudo code:

 

IF HTTPrequestA returns status code 400 THEN
Do HTTPrequestB
Do HTTPrequestC
print "did steps B & C"
Else
Do HTTPrequestD
print "did steps D"
End IF

 

This an actual line Of code I use to call the steps:
testRunner.gotoStepByName("HTTPrequestB");

 

So If I run the test and HTTPrequestA returns status code 400, is this the flow that will execute?

 

HTTPrequestA
GroovyStep
HTTPrequestB
HTTPrequestC
HTTPrequestD

 

Or is it like this, where when the goovy step finishes calling B & C, the B & C steps are repeated becasue they are next steps :

 

HTTPrequestA
GroovyStep
{
HTTPrequestB
HTTPrequestC
}
HTTPrequestB
HTTPrequestC
HTTPrequestD

 


I would prefer the 1st way. How do I do that?

No RepliesBe the first to reply