简体   繁体   中英

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. Both jmeter and Jenkins are installed on my local windows machine. I've set up some properties in Jmeter and verified that I can run them from the cmd line successfully with this command:

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.

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. 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 .

Then Jenkins Build step should be Windows Batch Command

Then the command should be 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.

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. They can also be integrated with Jenkins

The problem here is cross environment. you need to be running this with windows batch command instead of execute shell. windows wont recognize sh as executable.

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批处理模式

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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