[英]how do I get my jmeter test plan to execute in Jenkins on my local windows machine?
I'm trying to get My jmeter test plan to execute in Jenkins. 我正在尝试让我的jmeter测试计划在Jenkins中执行。 Both jmeter and Jenkins are installed on my local windows machine. jmeter和Jenkins都安装在我的本地Windows计算机上。 I've set up some properties in Jmeter and verified that I can run them from the cmd line successfully with this command: 我已经在Jmeter中设置了一些属性,并验证可以使用以下命令从cmd行成功运行它们:
C:\\Users\\MikeL\\Documents\\apache-jmeter\\bin>jmeter -n -t testApp.jmx -l log.jtl -Jenv=dev -JloopCount=2
Now in Jenkins I've created a new project, create two new parameters and entered the following in "execute shell" based off of exapmples I was able to find on the web.I haven't configured anything else in Jenkins. 现在,在Jenkins中,我创建了一个新项目,创建了两个新参数,并根据我在网络上可以找到的示例在“ execute shell”中输入了以下内容。我在Jenkins中未进行任何其他配置。
sh jmeter.sh -n -p user.properties -t C:/Users/MikeL/Documents/apache-jmeter/bin/testApp.jmx -l log.jtl -Jenv=dev -JloopCount=1
suffice to say this script won't build my jmeter test. 足以说这个脚本不会建立我的jmeter测试。 I recieve this error: 我收到此错误:
Cannot run program "sh" (in directory "C:\\Program Files (x86)\\Jenkins\\workspace\\LOS API Regression Tests"): CreateProcess error=2, The system cannot find the file specified
If anybody has any clues I'd be very grateful! 如果有人有任何线索,我将不胜感激!
Add this path C:\\Users\\MikeL\\Documents\\apache-jmeter\\bin
to your Environment Variables PATH
. 将此路径C:\\Users\\MikeL\\Documents\\apache-jmeter\\bin
到您的环境变量PATH
。
Then Jenkins Build step should be Windows Batch Command 然后,Jenkins Build步骤应为Windows Batch Command
Then the command should be jmeter -n -t testApp.jmx -l log.jtl -Jenv=dev -JloopCount=1
然后,该命令应为jmeter -n -t testApp.jmx -l log.jtl -Jenv=dev -JloopCount=1
Update: If you do not want to set the path, just directly give below command as Windows Batch Command. 更新:如果您不想设置路径,只需直接将以下命令作为Windows Batch Command即可。
C:\\Users\\MikeL\\Documents\\apache-jmeter\\bin\\jmeter.bat -n -t C:\\Users\\MikeL\\Documents\\apache-jmeter\\bin\\testApp.jmx -l log.jtl -Jenv=dev -JloopCount=1
Use either Ant/Maven/Gradle to run jmeter tests in the non-gui mode. 使用Ant / Maven / Gradle在非gui模式下运行jmeter测试。 They can also be integrated with Jenkins 它们也可以与Jenkins集成
The problem here is cross environment. 这里的问题是跨环境。 you need to be running this with windows batch command instead of execute shell. 您需要使用Windows批处理命令而不是执行Shell来运行它。 windows wont recognize sh as executable. Windows不会将sh识别为可执行文件。
C:\Users\MikeL\Documents\apache-jmeter\bin>jmeter -n -t testApp.jmx -l log.jtl -Jenv=dev -JloopCount=2
Run the above in execute windows batch mode 在执行Windows批处理模式下运行以上命令
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.