简体   繁体   English

JMETER -- 想要调用响应(响应数据 -- 正文)到其他 HTTP 请求的正文数据)

[英]JMETER -- want to call response (response data -- body) to body data of other HTTP request)

Hi I am new to JMETER and not sure what could be the possible solution for my query.嗨,我是 JMETER 的新手,不确定我的查询可能的解决方案是什么。

I have a scenario from my application which我的应用程序中有一个场景

  1. Create new invoice (unique invoice number all the time, say 141, 142, 143...)创建新发票(始终唯一的发票编号,例如 141、142、143...)
  2. Enter/ Select details输入/ Select 详细信息
  3. Save invoice (BODY data have invoice number as 141)保存发票(BODY 数据的发票编号为 141)

I have recorded script for this using Blazemeter.我已经使用 Blazemeter 为此录制了脚本。

Now when execute the script, the API call for new invoice always generates a new and unique invoice (as I can see from listener - View result tree) but when it tries to save, it fails with error Duplicate invoice number , which is as expected.现在,当执行脚本时,新发票的 API 调用总是生成一个新的唯一发票(正如我从侦听器 - 查看结果树中看到的那样)但是当它尝试保存时,它失败并出现错误Duplicate invoice number ,这是预期的.

If I replace the new body data's invoice number with new unique number (142), it saves the new invoice successfully in application but same script will fail again as body data have 142 and that invoice number was being created already.如果我用新的唯一编号 (142) 替换新正文数据的发票编号,它会在应用程序中成功保存新发票,但相同的脚本将再次失败,因为正文数据有 142 并且已经创建了该发票编号。

Any solution / comments to this problem will be appreciated.对此问题的任何解决方案/评论将不胜感激。

Your question is not clear enough so I can provide only generic piece of advice: parameterize these invoice numbers using suitable JMeter Functions您的问题不够清楚,所以我只能提供一般性建议:使用合适的 JMeter 函数参数化这些发票编号

  1. If you want to increment the number by 1 - __intSum()如果您想将数字增加 1 - __intSum()
  2. __counter() generates an incremented number each time it's being called __counter()每次被调用时都会生成一个递增的数字
  3. __strReplace() allows replacing one substring with another __strReplace()允许将一个 substring 替换为另一个

暂无
暂无

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

相关问题 将jmeter Http请求的响应数据保存在字符串Java代码中 - Save jmeter Http request's response data in string java code 如何将Bean shell处理器变量传递给jmeter中的HTTP Request body数据 - How to pass Bean shell processor variable in to HTTP Request body data in jmeter JMeter - 如何将多行响应数据传递给 ForEach Controller 请求 - JMeter - How to pass Multiline response data to the ForEach Controller request Jmeter:响应数据未完全加载 - Jmeter: Response data is not loaded completly Jemeter:HTTP 请求,收到成功响应 header 但请参阅“错误:过滤器查询缺少键“名称”的值。” 在身体里 - Jemeter: HTTP request, Received successful response header but see “Error: The filter query is missing a value for key 'name'.” in the body 无法使用 Jmeter 以 xml 格式获取带有 Response Data_Response Header 和 Request 标头的报告 - Unable to get report with Response Data_Response Header and Request header in xml format using Jmeter JMeter:获取响应时间但没有响应数据 - JMeter: Get response time but no Respons Data 身体数据无效的截击删除请求 - Volley delete request with body data not working 如何从 HTML 文档类型格式的响应正文中提取令牌值 - JMETER - How to extract token value from response body in a HTML doctype format - JMETER Jmeter-运行期间,适当的页面不会显示为响应数据 - Jmeter - During Run, appropriate pages are not displayed as response data
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM