Groovy in SOAPUI Asserting on repeating nodes located by expected data

跟風遠走 提交于 2019-12-06 14:51:41

Create an expected result as a map as below which is combination of Code and Result, so that both can be verified / asserted together.

['011': '4', '018': '0', '098': '2']

Use Script Assertion for the same request test step.

Here goes the script:

//assert if there is response
assert context.response, 'Response is null or empty
//change below map as needed
def expected = ['011': '4', '018': '0', '098': '2']
def xml = new XmlSlurper().parseText(context.response)
def actual = xml.'**'.findAll{it.name() == 'Details'}.collectEntries{[(it.Code.text()): it.Result.text()]}
assert expected == actual
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!