I need to parameterize jenkins job to run X times I need to parameterize jenkins job to run X times jenkins jenkins

I need to parameterize jenkins job to run X times


See https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build . You can define a parameter for your job. Then you just need to pass it to the and with -Denv_entry=value (normal JVM Sswitch, you find it in advanced settings of Ant step in Jenkins), which can pass it to jmeter (see this article: http://jmeter.apache.org/usermanual/get-started.html#override)

EDIT:You do not run JMeter in your ant script at all. So steps by step:

  1. Call your ant script with: -DTHREADS=value
  2. Ant script contains <property environment="env"/> correctly
  3. Call JMeter with your task with giving JVM argument like this:
<jmeter    jmeterhome="c:\jakarta-jmeter-1.8.1"    testplan="${basedir}/loadtests/JMeterLoadTest.jmx"    resultlog="${basedir}/loadtests/JMeterResults.jtl">  <jvmarg value="-Xincgc"/>  <jvmarg value="-Xmx128m"/>  <jvmarg value="-DTHREADS=${env.THREADS}"/></jmeter>

Then you will have a system property in JMeter. If you want to have a JMeter property use -JTHREADS=${env.THREADS} instead.

EDIT2:Add this:

<taskdef name="jvmarg" classname="org.programmerplanet.ant.taskdefs.jmeter.Arg" classpathref="ant.jmeter.classpath"/>

Then should work.


I think it would be a nicer approach if you did not try to run the Jenkins job N times, but pass this N parameter into your ant script (see other answers on how to pass parameters into ant from jenkins) and make that deal with starting the tests in parallel N times.