SOAP-UI - 如何检索多部分响应中的第二个正文部分并断言相同内容

发布于 2024-10-08 21:14:35 字数 415 浏览 0 评论 0原文

我们有一个 RESTful Web 服务,可以返回多方响应。 第一个主体部分是 xml,第二个主体部分是 xhtml。 我能够检索第一个主体部分并断言。 但是,我无法检索第二个正文部分,以便我可以对其进行 XPath 断言。 第二个身体部分作为附件出现。使用 grrovy 脚本,我可以访问附件并与预期的 xhtml 进行字符串比较。 更糟糕的是,我的要求是忽略特定标签中存在的少数属性,因为该值对于每个请求都是动态的,并且在执行断言时必须忽略。通过使用“允许通配符”选项,这在 XPath 断言中更容易实现。

我的问题是: 1. 有没有办法使用 XPath 断言来断言第二个正文部分。 2. 如果不是,如何使用 groovy 脚本忽略实际 xhtml/xml 中存在的一些属性来执行断言。 替代文本

We have a RESTful webservice that gives back a Multiparty response.
The first body part is an xml and the second is an xhtml.
I am able to retrieve the first bodypart and assert.
However, I am unable to retreive the second body part so that I can do the XPath assertion on the same.
The second body part was coming as an attachment. Using grrovy script, I am able to access is attachment and do a string comparison with the expected xhtml.
To add to the misery, my requirement is to ignore few attributes present in specific tags as the value will be dynamic for every request and has to ignored while performing assertion. This was easier to achieve in XPath assertion by making use of "Allow wildcards" option.

My questions are:
1. Is there a way to assert the second body part using XPath assertion.
2. If no, how can the assertion be peformed using groovy script by ignoring few attributes present in the actual xhtml/xml.
alt text

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文