SoapUI 5.5.0: conditional perform step using Groovy (previous response has mtom content type)
Snippet response teststep: signDocuments:
<soap:Reason>
<soap:Text xml:lang="nl">13 - De transactie is nog niet ondertekend.</soap:Text>
</soap:Reason>
<soap:Detail>
<ns1:Validatiefout xmlns:ns1="https://schemas.knb.nl/css/2.0">
<ns1:code xsi:type="xs:int" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">13</ns1:code>
</ns1:Validatiefout>
</soap:Detail>
Next step: groovy script:
try {
soapResponse = testRunner.testCase.testSteps['signDocuments'].testRequest.response.responseContent;
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context);
if(soapResponse.contains("soap:Fault") &&
soapResponse.contains("13 - ")) {
sleep(100)
testRunner.gotoStepByName("signDocuments")
}
} catch(Exception e) {
}
Goal: perform teststep 'signDocuments' as often as needed until the response doesn't contain message '13'.
I've tried a lot of different ways (including runStepByName, using property transfer, other code using for loop), but still it doesn't seem to iterate over the teststep and groovy script.
Does anyone have a clue?
Hi HimanshuTayal richie that worked!
Thanx for helping.So the groovy script now is:
soapResponse = testRunner.testCase.getTestStepByName("signDocuments").getPropertyValue("Response");
//log.info(soapResponse)
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context);if(soapResponse.contains("13 - "))
testRunner.gotoStepByName("signDocuments")else
testRunner.gotoStepByName("getTransaction")testRunner.testCase.getTestStepByName("Get status afgerond").getPropertyValue("Response")