cdav929
cdav929

Reputation: 25

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!

Upvotes: 1

Views: 2007

Answers (2)

vins
vins

Reputation: 15370

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

Upvotes: 2

chanukhya bachina
chanukhya bachina

Reputation: 181

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 batch mode

Upvotes: 0

Related Questions