Forum Discussion
andresmjc
New Contributor
This helped me out tremendously after searching through many posts. Did you ever get your issues resolved. My issue is that the script I wrote loops and calls itself. after it loops one time. it does go on to the next steps but the original script step fails.
jkrier
7 years agoRegular Contributor
This was a long time ago, I don't even remember why I needed this functionality anymore. I was messing with the script and it seems to be running without any issues.
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("Step1") sleep 700 testRunner.runTestStepByName("Step2") sleep 700 loop = loop + 1 } log.info 'Loop End' testRunner.gotoStepByName("End Loop")
There might be a better way to accomplish this by using the step indexes. Get the current step (Groovy loop script) index and just run so many, you could add a counter and do something like testRunner.runTestStepByName("Step" + stepIndex)
Related Content
- 6 years ago
Recent Discussions
- 2 days ago
- 2 days ago