Forum Discussion

sprei_09's avatar
Occasional Contributor
7 years ago

Data Driven Testing for SoapUI Free Version for REST POST Call.

I need to run a data driven testing for a POST request mentioned as below using the SoapUI Free version. Please help.

URI : http://serverIP:port

Request Body : {"get_range": [""] }

Response Body : {"ip_ranges": [{ "ip": "", "ipint": 1688834374, "end": 1688862719, "start": 168879718n4 }]}


Automation Script :

The script for single request is working. However, to make it data-driven, I have created an array with the request body and wanted to pass it to the test. The script for multiple request blobs is failing. Script :


import groovy.json.JsonSlurper

//DataDriven Testing

//def ipsArray = new String[2]

//ipsArray[0]='{"get_range": [""] }'

//ipsArray[1]='{"get_range": [""] }'

//def IpRangeRequestStep = testRunner.testcase.getTestStepByName(IpRangeRequest-1)

//def IpRangeRequest = IpRangeRequestStep.getTestRequest()





def ipRangeTest = testRunner.runTestStepByName("IpRangeRequest-1")

def response = ipRangeTest.getResponse()


def jsonStr = response.getContentAsString()

JsonSlurper serializer = new JsonSlurper()

def object = serializer.parseText(jsonStr)

object.each{ }


Attached is the screen capture of how the test was created.

4 Replies

  • nmrao's avatar
    Champion Level 3
    Would you mind showing how is your data that needs to be loop thru?

    Also how your request is supposed to be?