我有jmeter测试计划,在其中我创建了一个工作流,将"未开始"到"正在进行"等状态转换为"已完成"。我遇到的问题是我如何衡量工作流状态从创建到完成需要多长时间?由于我们仅记录 api 调用的响应时间。有没有办法提取此信息并将其添加到摘要中(jtl 报告?我在想我是否可以从 beanshell 后处理器中做到这一点,在那里我计算了等待时间并检查了工作流的状态,我可以写入摘要结果 (jtl(。我该怎么做?
我设置了这样的测试计划:
Thread Group
- Create Workflow API call
- WhileLoop(checking on a flag set by beanshell post processor)
- Wait for 5seconds
- Check for timeout using JSR223 sampler(java)(don't want test to run inevitably if something goes wrong so want to break the loop after a fixed amount of time)
- Get Workflow status API call
- Beanshell post processor to check the response from above call to see if status is Completed or wait time has exceeded. In either of these cases I set the while loop flag false if not repeat the loop wait for 5 seconds and so on.
对于测试本身,它按预期工作。
使用事务控制器来测量所花费的时间。请检查参考资料;-
事务控制器生成一个附加示例,该示例 测量执行嵌套测试元素所花费的总时间。
希望这有帮助。