Forum Discussion
M_McDonald
13 years agoSuper Contributor
You have to use Groovy scripts to do this in SoapUI free version. Get a list of file names then submit contents of each file in the request step.
First Groovy step to get list of files:
Followed by request step with this in the body:
Followed by another Groovy step to remove the file from the list, write the response to a file and loop back to the request as long as there are more files:
First Groovy step to get list of files:
def fileList = []
new File("C:\\requests").eachFile { f ->
if (f.isFile() && f.name.endsWith('.xml')) {
def filename = f.name[0..-5]
fileList.add(filename)
}
}
if (fileList.size() < 1) {
testRunner.fail("No request files")
}
context.put('fileList', fileList)
Followed by request step with this in the body:
${=new File("C:\\requests\\" + (context.get('fileList')).last() +".xml").text}
Followed by another Groovy step to remove the file from the list, write the response to a file and loop back to the request as long as there are more files:
def fileList = context.get('fileList')
def fileName = fileList.pop()
def response = context.expand( '${Test Request#Response}' )
def f = new File("C:\\responses\\${fileName}_Response.xml")
f.write(response, "UTF-8")
if (fileList.size() > 0) {
testRunner.gotoStepByName('Test Request')
}
Related Content
- 7 years ago
- 6 years ago
- 3 years ago
- 7 years ago
Recent Discussions
- 2 days ago