Properties ScreenshotResponse Snippet
<tns:TAResponse
xmlns:tns="http://webconnectivity.co.uk/">
<tns:SessionToken>84hjfutryh47849dkdhg9493493=</tns:SessionToken>
<tns:PartyId>1234</tns:PartyId>
<tns:ResponseType></tns:ResponseType>
<tns:MessageUUId>12341F17-ABC9-3E99-1D12-B8289POO2107</tns:MessageUUId>
<tns:Matches>
<tns:IntegrationServiceMatch>
<tns:InternalReference>2066856</tns:InternalReference>
<tns:ErrorsAndWarnings>
<tns:IntegrationServiceErrorCode>
<tns:ErrorCode>W000026</tns:ErrorCode>
<tns:Description>Settlement Date not within tolerance</tns:Description>
</tns:IntegrationServiceErrorCode>
<tns:IntegrationServiceErrorCode>
<tns:ErrorCode>E000033</tns:ErrorCode>
<tns:Description>Number on message does not match</tns:Description>
</tns:IntegrationServiceErrorCode>
<tns:IntegrationServiceErrorCode>
<tns:ErrorCode>E000001</tns:ErrorCode>
<tns:Description>NO likely matches</tns:Description>
</tns:IntegrationServiceErrorCode>
</tns:ErrorsAndWarnings>
</tns:IntegrationServiceMatch>
</tns:Matches>
</tns:TAResponse>
I have stored all these Errorcode and Description in a property step. I need to validate whether these Errorcode and Description in the response matches with the property step. (sequence is not a deal) Can someone pls guide me through groovy? Previously i had to validate only one errorcode and desc from the response. so i validated using below script.
def content = new XmlSlurper().parse(file)
def respType = content.Body.TAResponse.ResponseType.text()
def errAndWarn = content.Body.TAResponse.Matches.IntegrationServiceMatch
assert errAndWarn.size() == 1
for (def i=0;i<errAndWarn.size();i++)
{
assert errAndWarn[i].ErrorsAndWarnings.IntegrationServiceErrorCode.ErrorCode == "E000033"
assert errAndWarn[i].ErrorsAndWarnings.IntegrationServiceErrorCode.Description == "Number on message does not match"
}
You can use below
Script Assertion
for the SOAP Request test step itself, that will avoid additionalGroovy Script
test step.This assumes that the name of the Properties test step name is
Properties
. If its name differs, then change in the script accordingly.Script Assertion
EDIT: based on OP's comment
Groovy Script test step:
EDIT2: Based on additional requirement, adding below Groovy Script
You should be able to do: