即使脚本实际通过,Jenkins 仍显示 JMeter 脚本失败 [英] Jenkins shows JMeter script failure even though the script actually passed
问题描述
我的 jmeter 脚本从 jenkins 作业运行,但它总是报告它失败,即使脚本实际上通过了.我正在使用发布性能测试结果报告构建后操作".请看截图.我究竟做错了什么?为什么即使实际的 jmeter 脚本正在通过,它也总是显示错误?
I have my jmeter script running from a jenkins job but it is always reporting it as failed even though the script actually passed. I am using the 'Publish Performance test result report Post-build Action. Please see screenshot. What am I doing wrong? Why does it always show an error even though the actual jmeter script is passing?
推荐答案
我找到了一种方法!使用这个插件:https://wiki.jenkins.io/display/JENKINS/日志+解析器+插件
I found a way to do this! Use this plugin: https://wiki.jenkins.io/display/JENKINS/Log+Parser+Plugin
在包含这一行的规则文件中:
错误/失败/
In a rules file containing this line:
error /FAILED/
在脚本中为每个 HTTP 请求添加一个 beanshell 断言,它将记录成功和失败的消息.举个例子:
In the script add a beanshell Assertion for each HTTP Request that will log messages for successes and failures. Here's one example:
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);
}
这篇关于即使脚本实际通过,Jenkins 仍显示 JMeter 脚本失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!