as discussed HERE in soapUI free version i'm trying to call this WS:
<soap:Body>
<RequestParameters>
<Parameter name="key" value="SomeorderId"/>
</RequestParameters>
</soap:Body>
and i want to take the values of "key" from a local data.txt file on my desktop. the content of this file:
9999999991
9999999992
9999999993
to do so, i've created a test suite with below three test steps:
1.first step: a groovy script:
def data = new File('C:/Users/Polarick/Desktop/data.txt')
data.eachLine { orderId ->
context.orderId = orderId
//Get the step2, index of the step is 1
def step = context.testCase.getTestStepAt(1)
//Run the step2
step.run(testRunner, context)
}
//all the orders got executed,jump to step2, index is 2
testRunner.gotoStep(2)
2.second step: modifying request:
<Parameter name="MSISDN" value="${orderId}"/>
and asserting this script to it:
//Check if there is response
assert context.request, "Request is empty or null"
//Save the contents to a file
def saveToFile(file, content) {
if (!file.parentFile.exists()) {
file.parentFile.mkdirs()
log.info "Directory did not exist, created"
}
file.write(content)
assert file.exists(), "${file.name} not created"
}
def response = context.expand( '${Step2#Response}' )
def f = new File("C:/Users/Polarick/Desktop/${context.orderId}_Response.xml")
f.write(response, "UTF-8")
saveToFile(f, context.response)
3.Third step: a groovy script:
log.info "Test completed."
It all works fine and calls the WS for all lines existing in data.txt file sequentially, but i'm expecting to find a response .xml file per execution, for example:
C:/Users/Polarick/Desktop/9999999991_Response.xml
C:/Users/Polarick/Desktop/9999999992_Response.xml
C:/Users/Polarick/Desktop/9999999993_Response.xml
but there is no response file generated, can you help?