Forum Discussion

ghosh's avatar
New Contributor
7 years ago

Soap UI_free version_more than one record fetch

Hi All,


I am facing a problem while want to fetch more than 1 records from test case level to put in REST req which is in JSON format.

I have used below codes in groovy test step to fetch the records from test case custom property level, but unable to send it to my required REST request input(JSON).



def s = testRunner.testCase.getPropertyValue( "airports")
def list = s.split(',')

def i = Integer.parseInt(testRunner.testCase.getPropertyValue( "counter"))
if (i < list.size()) {

// Do your action here list[i]

// increment the counter
testRunner.testCase.setPropertyValue( "counter", i.toString())


else {
// Otherwise we set counter to initial value
testRunner.testCase.setPropertyValue( "counter", new Integer(0).toString())



Here im getting the output in console only.

Please help.



3 Replies

  • unless I am totally missing your question I would say that all you need to do is add ${Groovy Script#result} to your JSON input for the parameter you are needing to put the airport value. Then every time it loops through it would add the next airport value.

    • ghosh's avatar
      New Contributor

      I have added this ${Groovy Script#result} in my JSON request body, but not working

      • bagochips's avatar

        is the name of your step that your groovy code is in named "Groovy Script"? If so then it should pull the result from that step and put it into your JSON. If it is named something else then you need to update ${Groovy Script#result} to reflect then name ${<step name>#result}