JMeter上的HTTP请求测试失败 [英] HTTP request on JMeter test failure

查看:884
本文介绍了JMeter上的HTTP请求测试失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的JMeter测试中,如果有任何错误,我想触发HTTP请求以在系统上发布消息,以进一步关注.我在这里可以做什么?邮件可视化工具可以很好地通过电子邮件报告错误.我想做同样的事情,但是要通过HTTP请求.我正在使用jmeter 3.2.

In my JMeter test, if there is any error, I want to trigger HTTP request to post a message on my system for further attention. What can I do here? Mail visualiser works fine to report errors over email. I want to do the same but over HTTP request. I am using jmeter 3.2.

推荐答案

您可以执行以下操作:

  1. 在HTTP请求采样器之后添加 If Controller 将以下代码放入条件"区域:

  1. Add If Controller after the HTTP Request sampler and put the following code into "Condition" area:

`!${JMeterThread.last_sample_ok}`

  • SMTP采样器添加为If Controller的子代,并配置您的电子邮件服务器详细信息,凭据,消息等-参见

  • Add SMTP Sampler as a child of the If Controller and configure your email server details, credentials, message, etc. there - see Load Testing Your Email Server: How to Send and Receive E-mails with JMeter article for more details.
  • JMeterThread.last_sample_ok预定义的JMeter变量,用于保存结果如果先前的采样器执行成功,则如果先前的采样器成功执行,则为true,否则为false.由于使用了If Controller,因此仅在HTTP Request采样器失败的情况下才执行SMTP请求采样器,这似乎是您要寻找的东西.

    JMeterThread.last_sample_ok is a pre-defined JMeter Variable holding the result of previous sampler execution, it is true if previous sampler is successful and false otherwise. Due to the If Controller the SMTP Request sampler will only be executed in case of HTTP Request sampler failure which seems to be something you're looking for.

    这篇关于JMeter上的HTTP请求测试失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆