11 years ago
Rest Call with Data Driven Groovy Script
Hello Guys
I am using the Groovy Script to fetch data from a .txt file to run my Rest Service Call. The Response is in JSON format. Can somebody point to me what is wrong with the below script...I am using SOAP UI 5.0.0. Has someone done this with Groovy... pls share the thoughts.
def FilePath = "C:\\SOAP-DS.txt"
context.fileReader = new BufferedReader(new FileReader(csvFilePath))
rowsData = context.fileReader.readLines()
int rowsize = rowsData.size()
for(int i =0; i< rowsize; i++)
{
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
rowdata = rowsData
String[] data = rowdata.split(",")
testRunner.runTestStepByName("Properties")
context.setProperty("Fname",data[1])
context.setProperty("numberOfRecordsRequested",data[2])
context.setProperty("DOB",data[2])
testRunner.runTestStepByName("getDetails")
def Res=groovyUtils.getjsonHolder("getDetails#Response")
//Res=context.expand(Res.getXml())
Res=context.expand(Res.getjson())
}
I am using the Groovy Script to fetch data from a .txt file to run my Rest Service Call. The Response is in JSON format. Can somebody point to me what is wrong with the below script...I am using SOAP UI 5.0.0. Has someone done this with Groovy... pls share the thoughts.
def FilePath = "C:\\SOAP-DS.txt"
context.fileReader = new BufferedReader(new FileReader(csvFilePath))
rowsData = context.fileReader.readLines()
int rowsize = rowsData.size()
for(int i =0; i< rowsize; i++)
{
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
rowdata = rowsData
String[] data = rowdata.split(",")
testRunner.runTestStepByName("Properties")
context.setProperty("Fname",data[1])
context.setProperty("numberOfRecordsRequested",data[2])
context.setProperty("DOB",data[2])
testRunner.runTestStepByName("getDetails")
def Res=groovyUtils.getjsonHolder("getDetails#Response")
//Res=context.expand(Res.getXml())
Res=context.expand(Res.getjson())
}