简体   繁体   English

如何将Jmeter响应数据转换为字节? 如何将Byte值存储到CSV文件中?

[英]How to convert Jmeter Reponse data in to Byte? How to store the Byte value into CSV file?

Our new requirements is there is script A we need to run on two different environment 1 and environment 2. 我们的新要求是有脚本A,我们需要在两个不同的环境1和环境2上运行。

So we need to convert the response data into on Byte and store into Csv file. 因此,我们需要将响应数据转换为Byte并存储到Csv文件中。 Later we need to compare the both byte result from different environment. 稍后,我们需要比较来自不同环境的两个字节的结果。

But now we need to know how to convert the Response data into Byte and store in byte value in one file? 但是现在我们需要知道如何将Response数据转换为Byte并以字节值存储在一个文件中?

Any can please help us 任何人都可以帮助我们

Storing response data is not something recommended as it causes high Disk IO overhead. 不建议存储响应数据,因为它会导致高磁盘IO开销。 I would suggest modifying your design a little bit, ie 我建议您稍微修改一下设计,即

  1. Switch to "Advanced" tab of the HTTP Request sampler and tick the box Save repsonse as MD5 hash 切换到HTTP请求采样器的“高级”标签,然后选中Save repsonse as MD5 hash

    JMeter将响应另存为MD5哈希

  2. When you run your test you will see MD5 checksum like 09b9c392dc1f6e914cea287cb6be34b0 . 运行测试时,您将看到MD5校验和,09b9c392dc1f6e914cea287cb6be34b0 The idea is that equal responses will have equal MD5 hashes and storing hashes is a more lightweight process. 想法是,相等的响应将具有相等的MD5哈希值,并且存储哈希值是一个更轻量的过程。

Be aware that you can also use MD5Hex Assertion in order to automatically fail sampler if response isn't equal to expected, check out How to Use JMeter Assertions in Three Easy Steps for details. 请注意,如果响应不符合预期,您也可以使用MD5Hex断言自动使采样器失败,请查看“ 三个简单步骤”中的“如何使用JMeter断言”以获取详细信息。

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

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