简体   繁体   English

JMETER_HOME 环境变量未正确定义,但构建成功,脚本在 Jmeter GUI 和 cmd 提示符下工作正常

[英]JMETER_HOME environment variable is not defined correctly but build is successful and the script works fine in Jmeter GUI and cmd prompt

I have created a jmeter jmx script and it is getting executed perfectly in GUI and non GUI mode.我创建了一个 jmeter jmx 脚本,它在 GUI 和非 GUI 模式下完美执行。 I have configured the same in Jenkins but I am getting the build success with an error message as "The JMETER_HOME environment variable is not defined correctly This environment variable is needed to run this program"我在 Jenkins 中进行了相同的配置,但是我得到了构建成功并显示错误消息为“未正确定义 JMETER_HOME 环境变量此环境变量是运行此程序所必需的”

I have also tried setting the JMETER_HOME as E:\apache-jmeter-4.0 in User variables and Path as E:\apache-jmeter-4.0\bin in System Variables and it didn't work.我还尝试在用户变量中将 JMETER_HOME 设置为 E:\apache-jmeter-4.0 ,在系统变量中将路径设置为 E:\apache-jmeter-4.0\bin ,但它不起作用。

I tried the below Questions but no luck.我尝试了以下问题,但没有运气。

'jmeter' is not recognized as an internal or external command, operable program or batch file 'jmeter' 不是内部或外部命令、可运行程序或批处理文件

JMETER_HOME environment variable is not defined JMETER_HOME 环境变量未定义

Here is my command and error from jenkins这是来自 jenkins 的命令和错误

E:\apache-jmeter-4.0\bin\jmeter -jjmeter.save.saveservice.output_format=xml -n -t E:\JMeter Tutorial\JenkinsIntegration.jmx -l E:\JMeter Tutorial\JenkinsIntegrationResult.jtl E:\apache-jmeter-4.0\bin\jmeter -jjmeter.save.saveservice.output_format=xml -n -t E:\JMeter Tutorial\JenkinsIntegration.jmx -l E:\JMeter Tutorial\JenkinsIntegrationResult.jtl

在此处输入图像描述 在此处输入图像描述

The easiest way of setting an environment variable is defining it under Manage Jenkins - Configure System - Global properties:设置环境变量的最简单方法是在管理 Jenkins - 配置系统 - 全局属性下定义它:

在此处输入图像描述

The better way would be using Environment Injector plugin更好的方法是使用Environment Injector插件

And last but not the least, you're getting this message because you're sitting at outdated JMeter 4.0, if you upgrade to ie JMeter 5.2.1 you won't be seeing this warning, moreover according to 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure article you should always be using the latest version of JMeter so in any case upgrade does make sense, check out what is the latest stable JMeter version and switch to it最后但并非最不重要的一点是,您正在收到此消息,因为您坐在JMeter 4.0 上负载测试“内存不足”故障文章您应该始终使用最新版本的 JMeter 所以无论如何升级都有意义,请查看最新稳定的 JMeter版本并切换到它

I removed Jenkins and reinstalled as well as i deleted the old job and created a new job with default settings in jenkins (i dint do anything in the manage Jenkins) and it worked charm with both jmerer 4.0 and 5.3.我删除了 Jenkins 并重新安装,并删除了旧作业并在 jenkins 中使用默认设置创建了一个新作业(我在管理 Jenkins 中做任何事情),它与 jmerer 4.0 和 5.3 都具有魅力。 java 1.8.0_251 java 1.8.0_251

在此处输入图像描述

with 5.3 5.3 在此处输入图像描述

with 4.0 4.0 在此处输入图像描述

as far i remember i just removed the space and added underscore in the below command from folder name JMeter Tutorial to Jmeter_Tutorial据我记得,我刚刚删除了空格并在以下命令中从文件夹名称 JMeter Tutorial to Jmeter_Tutorial 添加了下划线

E:\apache-jmeter-4.0\bin>E:\apache-jmeter-4.0\bin\jmeter.bat -Jjmeter.save.saveservice.output_format=xml -n -t E:\JMeter_Tutorial\JenkinsIntegration.jmx -l E:\JMeter_Tutorial\JenkinsIntegrationResult.csv E:\apache-jmeter-4.0\bin>E:\apache-jmeter-4.0\bin\jmeter.bat -Jjmeter.save.saveservice.output_format=xml -n -t E:\JMeter_Tutorial\JenkinsIntegration.jmx -l E :\JMeter_Tutorial\JenkinsIntegrationResult.csv

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM