cancel
Showing results for 
Search instead for 
Did you mean: 

Run a test step multiple times

SOLVED
Highlighted
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

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!

View solution in original post

6 REPLIES 6
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


 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!
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

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!

View solution in original post