Solved
Forum Discussion
6 Replies
Sort By
- ReshmaSachdevContributorHello,
You can write following groovy step to run as many times as you want.
if( context.loopIndex == null )
context.loopIndex = 0
if( ++context.loopIndex < 10 )
testRunner.gotoStepByName( "Name of TestStep to run n times" )
Same thing can be achieved using data source loop to run as required number of times by specifying those many rows.
But I feel groovy way is better to achieve this.
Hope it helps. - SoapRookieOccasional ContributorHi ReshmaSachdev,
Thank you for your reply. I am a new to Groovy, but not new to programming.
I have created a Groovy Script at the end of the test steps and entered the code suggested by you (All I did was replace the test step name, which is within braces). The script ran fine.
And I got the output as, "INFO: Going to step[user.votePoll]
But the Poll has not been voted multiple times. So the test step has not been ran multiple times. Do I need to add more scripting for the step to be ran multiple times? Also, how can debug this?
Thanks for your help,
SoapRookie - ReshmaSachdevContributorHi,
Sorry for replying late.
Please refer the file attached to execute n - number of times a test step.
Here in that i was trying to execute Request 1, 3 times [for understanding purpose, i have added property transfer and groovy steps to display the values], after executing n times, you can add your further steps.
Hope it helps. - Just noticed that the original posts asks about the SoapUI Pro functionality.
In Pro, you could just add a "DataSource" and "DataSource Loop" steps around your requests. The following article talks about the sample setup: http://www.soapui.org/Data-Driven-Testi ... tests.html
Thanks,
Michael Giller
SmartBear Software- ashutoshOccasional Contributor
HI Michael,
The link you have shared is not working. Can you share the updated link.
Hi ashutosh,
Refer to this ReadyAPI article edscribing how to create Data Driven tests:
https://support.smartbear.com/readyapi/docs/testing/data-driven/index.html