【发布时间】:2016-10-13 07:40:02
【问题描述】:
我有一个脚本断言,它将 XML 响应中的值 A 与值 B、C 和 D 进行比较。如果值 A 等于值 B、C 或 D 中的任何一个,则断言通过,否则失败。
// get the xml response
def response = messageExchange.getResponseContent()
// parse it
def xml = new XmlSlurper().parseText(response)
// find your node by name
def node = xml.'**'.find { it.name() == 'total-premium' }
// assert
(assert node.toString().matches("(36.476|38.395|40.315)\\d*"))
目前,对于通过的断言,我在日志中得到了这个字符串:
Step 1 [TestStep_0001] OK: took 2296 ms
一个失败的断言我在日志中得到了这个字符串:
-> [Script Assertion] assert node.toString().matches((36.476|38.395|40.315)\\d*") | | | | 37.6033658 false 37.6033658
如您所见,它有点混乱,我正在尝试整理测试套件日志。
有没有办法在日志中设置自定义响应?
【问题讨论】:
标签: xml groovy soapui assertions