Forum Discussion
jkrier
12 years agoRegular Contributor
I have rebuilt my project, although it's slightly different than my original. I couldn't remember the steps exactly but this is producing the same problem I had originally. When I run the test suite it loops infinitely, if I run the project but disable the loop and then run the loop from inside of the Groovy step manually it works fine. Can you explain why my Groovy loop is handled differently when ran from the suite versus the step itself?
I've attached a screen shot of my SoapUI console. I disabled the last step (The Groovy step that contains my loop) and then ran my project from the suite. After it stopped at the Groovy step I then ran the Groovy step manually from inside of the step itself. You can see that it runs the expected amount of times. If I run the project from the suite and enable the Groovy step it will loop infinitely.
I'm still using the same code for my loop but here it is again just in case.
def loop = 0
log.info loop
while (loop < 2){ //must match if loop
log.info "Still Running " + loop
//You have to explicitly list all steps to run between the loop script and the test step loop start
testRunner.runTestStepByName("getTransitionPackages")
sleep 1000
testRunner.runTestStepByName("getUniqueExternalReferenceValue 1")
sleep 1000
testRunner.runTestStepByName("UpdateService_TransitionServiceItem")
sleep 1000
testRunner.runTestStepByName("GetTXSrvItmRef")
sleep 1000
testRunner.runTestStepByName("getSoaTransactionsByExternalAccountReference 2")
sleep 1000
testRunner.runTestStepByName("CheckTransitionStatus")
sleep 1000
loop = loop + 1
log.info loop
}
if (loop == 2){ //must match while loop
testRunner.gotoStepByName("SuspendAccount")
loop = 0
log.info loop
log.info "ALL DONE "+loop
}
I've attached a screen shot of my SoapUI console. I disabled the last step (The Groovy step that contains my loop) and then ran my project from the suite. After it stopped at the Groovy step I then ran the Groovy step manually from inside of the step itself. You can see that it runs the expected amount of times. If I run the project from the suite and enable the Groovy step it will loop infinitely.
I'm still using the same code for my loop but here it is again just in case.
def loop = 0
log.info loop
while (loop < 2){ //must match if loop
log.info "Still Running " + loop
//You have to explicitly list all steps to run between the loop script and the test step loop start
testRunner.runTestStepByName("getTransitionPackages")
sleep 1000
testRunner.runTestStepByName("getUniqueExternalReferenceValue 1")
sleep 1000
testRunner.runTestStepByName("UpdateService_TransitionServiceItem")
sleep 1000
testRunner.runTestStepByName("GetTXSrvItmRef")
sleep 1000
testRunner.runTestStepByName("getSoaTransactionsByExternalAccountReference 2")
sleep 1000
testRunner.runTestStepByName("CheckTransitionStatus")
sleep 1000
loop = loop + 1
log.info loop
}
if (loop == 2){ //must match while loop
testRunner.gotoStepByName("SuspendAccount")
loop = 0
log.info loop
log.info "ALL DONE "+loop
}