我使用XMLSlurper来定义XML来自JDBC查询结果,但是如何在结果的部分上断言?
我有一串XML作为此脚本的响应, // 。
导入
groovy.json
返回 //
我想断言resp对象的长串联字符串的部分。
我刚刚询问,并从一个带有5列的数据库中恢复了记录(这5个文本是“任何内容”的示例文本),
谢谢!
I've got a string of xml as the response from this script,
//
import groovy.json.*
def resp = new XmlSlurper().parseText(messageExchange.getResponse().responseContent)
assert (resp == "whateverwhatever"), "ERROR: invalid result!!"
return
//
and I want to assert on pieces of the long concatenated string that the resp object is.
I just queried and am getting back a record(s) from a database with 5 columns (those 5 cols of text are the "whateverwhatever" example text)
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能直接对您获得的XML对象上的断言,
可以在getAT和类似函数下使用,以从xml获取整体或一些特定的内容,然后
使用log.info尝试使用
ostert 。示例代码可以指导您
从XML上在XML上实现主张,我们正在尝试与DOT操作员达到特定的节点,然后我们获得的文本我们正在断言它
You cannot directly apply assert on that XML object you get
you can use like below the getAt and similar function to get the whole or some specific content from XML and then apply the assert
Try using log.info to know the details at each step
Sharing some sample code which can guide you to achieve assertion on XML
Here from the XML we are trying to reach a particular node with dot operator and then the text we get we are asserting it