Jenkins显示JMeter脚本失败,即使脚本实际通过了

时间:2017-09-25 15:36:39

标签: jenkins jmeter

我的jmeter脚本是从jenkins作业运行的,但即使脚本实际通过,也始终将其报告为失败。我正在使用'发布性能测试结果报告构建后操作。请看截图。我究竟做错了什么?即使实际的jmeter脚本正在通过,为什么它总是显示错误?enter image description here

2 个答案:

答案 0 :(得分:1)

您将Unstable / Failure的阈值设置为0,因此即使0也视为失败。

增加不稳定和失败的阈值

答案 1 :(得分:0)

我找到了办法!使用此插件:https://wiki.jenkins.io/display/JENKINS/Log+Parser+Plugin

在包含此行的规则文件中:
    错误/失败/

在脚本中为每个HTTP请求添加一个beanshell Assertion,它将记录成功和失败的消息。这是一个例子:

String testscenario = "TEST SCENARIO: ";
String requestName = "Find Stuff";
String findStuff = "${MyStuff}";
String custName = "${CustName}";
String respData = new String(ResponseData);

if (respData.contains(findStuff))
{
    log.info(testscenario+"Passed. "+requestName+" MyStuff for Cust: " + 
custName + " containing " + findStuff + " returned.");      
    print(testscenario+"Passed. "+requestName+" MyStuff for Customer " + 
custName + " containing " + findStuff + " returned.");  
} else 
{
    log.error(testscenario+"*FAILED. "+requestName);    
    print(testscenario+"*FAILED. "+requestName);    
}