cancel
Showing results for 
Search instead for 
Did you mean: 

Run a test step multiple times

SOLVED
Occasional Contributor

Run a test step multiple times

In SoapUI Pro, within a test case, is it possible to run a test step 3 times before moving to the next test step?
If so, can someone suggest how can I do this?

SoapRookie
1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

Re: Run a test step multiple times

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

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
6 REPLIES 6
Highlighted
Contributor

Re: Run a test step multiple times

Hello,
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.
Occasional Contributor

Re: Run a test step multiple times

Hi 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
Contributor

Re: Run a test step multiple times

Hi,
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.

Re: Run a test step multiple times

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


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.
Occasional Contributor

Re: Run a test step multiple times

HI Michael,

The link you have shared is not working. Can you share the updated link.

Community Manager

Re: Run a test step multiple times

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

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video:
6 / 7 API Testing Mistakes Video
Top Kudoed Authors