简体   繁体   English

在多个服务器上重播HTTP请求并比较结果

[英]Replaying HTTP requests on multiple servers and comparing the results

I have two different implementations of an application, which should return identical results for identical requests. 我有一个应用程序的两种不同实现,对于相同的请求应返回相同的结果。 The second implementation is a re-write of the application, so we can consider the first implementation as the reference. 第二种实现是对应用程序的重写,因此我们可以将第一种实现视为参考。

I have the idea of testing the second implementation by comparing the results returned from it to the results returned by the first one for identical requests. 我的想法是通过比较从第二个实现返回的结果与第一个实现针对相同请求返回的结果来进行测试。

Ideally, I'd want to do this on a large number of HTTP requests, recorded from an operational deployment (using some proxy to record, or access log). 理想情况下,我想对大量HTTP请求执行此操作,这些HTTP请求是从操作部署中记录的(使用某些代理记录或访问日志)。

I'm looking for a set of tools that makes this scenario possible without too much coding (alternative is that I can write a tool to do this for me) : 我正在寻找一套无需过多编码即可使这种情况成为可能的工具(或者,我可以编写一个工具为我做这个):

  1. Record requests on production (Access logs, Charles proxy, etc.) 在生产中记录请求(访问日志,Charles代理等)
  2. Replay the requests on both servers 在两个服务器上重播请求
  3. Detect any difference in returned response 检测返回响应中的任何差异

I've seen similar approaches for real-world load testing (using JMeter to replay access logs, or what Charles Proxy does) but what I need in addition is the comparison of results to have functional testing. 我已经看到了用于实际负载测试的类似方法(使用JMeter重放访问日志或Charles Proxy所做的事情),但是我还需要进行功能测试的结果比较。

The target system is on a Java implementation family (Servlet containers, JSP, log4j, etc.) if this may have something to do with the answer, but I figure this is a pure HTTP, Network and functional testing problem and the solution may be independent from server type and implementation. 如果这可能与答案有关,则目标系统位于Java实现家族(Servlet容器,JSP,log4j等)上,但我认为这是一个纯粹的HTTP,网络和功能测试问题,解决方案可能是与服务器类型和实现无关。

Jmeter would be a good place to start. Jmeter将是一个不错的起点。 You can have it replay your access log and it has the option to add assertions. 您可以让它重播访问日志,并且可以选择添加断言。 EDIT: After looking into it some more. 编辑:研究了更多之后。 You can add two Access Log Samplers that read the same log and fire to your two different servers. 您可以添加两个读取相同日志并触发到两个不同服务器的访问日志采样器。 Add a post processor node to each of them that extracts the body and assigns them to a variable. 向每个后处理器节点添加一个后处理器节点,以提取主体并将其分配给变量。 Then you can use assertions to compare the two. 然后,您可以使用断言来比较两者。 Read about using those elements . 阅读有关使用这些元素的信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM