I understand that this is a SoapUI Pro forum but I think creating the loop steps through groovy manually can be a good lesson and can help you customise your loops to your heart (and/or requirement)'s content!
So without further ado this is how I script my groovy loopers
NOTE: in this example I am connecting to an OracleDB to fuel my requests.
The structure within my test case is quite simple: loopStarter to connect to the db/initialise the data - storing the current information into properties, response to send these properties off to the API through a request, loopEnder to either propagate or exit the loop if the condition is met.
Connection to/creation of your data source, be it a database, excel etc
In this example I will be using the groovy.sql class (documentation) to connect to my db, and store the results into properties
sql = Sql.newInstance(<connection details>)
def res = sql.rows(<sql query>)
def loopProperties = testRunner.testCase.getTestStepByName("loopProperties")
//will initialise count in the loopProperties step if count does not yet exist
def count = Integer.parseInt(loopProperties.getPropertyValue("count"))
//store the properties from the current result
sql.rows returns an array of ArrayLists, so to access the current result (more on this later) we will use res[count]. Just to reiterate this step ONLY sets the properties to be sent off in the request. querySize is set so we can continue looping over all the results from the query.
To then call your properties into your request step we will do this:
I've been thinking of doing something similar to this for the Excel DataSource script @Olga_T mentioned, well similar to the loopStarter step anyway - doing it completely through groovy so SoapUI free users can do it too, I just need to look into parsing exel files with groovy.
Anyways I hope this helps you all,
If my answer helped you out, please consider leaving kudos and/or accepting as a solution. Have an awesome day!