SoapUI:重新验证(记录的)请求/响应对
有没有一种方法可以记录响应(即使在一个“测试会话”期间非永久记录响应),我可以使用诸如“请验证(新)响应与这个(旧记录)响应完全相同”之类的断言。 该用例是对适用于多个 Web 服务的更改进行回归测试,然后必须重新测试以确保没有副作用。
Is there a way to record a response (even non permanently during one "test-session") in a way that I can use an assertion like "please validate that the (new) response is exactly like this (old recorded) one".
The use case is a regression test for changes which apply to several web services, which then have to be retested to be sure there were no side-effects.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设,在更改 Web 服务后,旧响应将仅作为保存的 XML 文件或日志文件可供您的测试使用。
我还假设您拥有免费版本的 SoapUI。
你的 Groovy 有多好?如果您将旧响应复制并粘贴到 XML 文件中,则可能有一种方法可以让您在 Groovy 脚本断言或 Groovy 脚本步骤中读取该 XML 文件。这部分也可以通过从 XML 创建 Groovy 类并确保该类位于 SoapUI 的类路径中来完成。
在该 Groovy 断言或步骤中,您可以从该文件中的 XML 创建一个新的 XMLSlurper 对象(或通过引用该类),并将 XMLSlurper 对象中的值与新响应中的值进行比较。
警告:我自己没有尝试过,但如果您无法以任何其他方式获得旧的响应并且您正在使用免费版本,那么这是我想到的第一件事。
I'm assuming that, after the Web service is changed, the old response will be available to your test only as a saved XML file or log file.
I'm also assuming that you have the free version of SoapUI.
How good is your Groovy? There might be a way, if you copied and pasted the old response into an XML file, for you to read in that XML file in a Groovy script assertion or Groovy script step. This part might also be done by creating a Groovy class from the XML and making sure that the class is in SoapUI's classpath.
Within that Groovy assertion or step, you would create a new XMLSlurper object from the XML in that file (or by referencing the class) and compare the values in the XMLSlurper object to the values in your new response.
Caveat: I haven't tried this myself but it's the first thing that comes to my mind if you won't be able to get the old response any other way and you're working with the free version.