1

Goal: jmeter test run on Jenkins.

I've created a script in Jmeter.

I've downloaded jmeter-maven-plugin.

I've created the jmeter directory (where I've put my script) in jmeter-maven-plugin/scr/testwhere directory.

I don't know what to do next.

Gryu
  • 2,102
  • 2
  • 16
  • 29
verbatim
  • 21
  • 4
  • 1
    Welcome to [so]. Questions here are expected to be __specific programming problems__ expressed _clearly_. Please take a __[tour]__. – Unihedron Aug 23 '14 at 13:42

3 Answers3

3

from the doc :

Add the plugin to the build section of your pom's project :

<plugin>
    <groupId>com.lazerycode.jmeter</groupId>
    <artifactId>jmeter-maven-plugin</artifactId>
    <version>1.9.1</version>
    <executions>
        <execution>
            <id>jmeter-tests</id>
            <phase>verify</phase>
            <goals>
                <goal>jmeter</goal>
            </goals>
       </execution>
    </executions>
</plugin>

Then you can create a new jenkins job on your project and run the jmeter tests by definig this command in the job configuration:

mvn verify
ben75
  • 29,217
  • 10
  • 88
  • 134
  • 1
    I should add this plugin to pom where is actually in jmeter-maven-plugin or I should create a new pom.xml ? I'm beginner. – verbatim Aug 23 '14 at 13:24
  • You must add it to your pom.xml at root of **your** project – ben75 Aug 23 '14 at 13:38
  • To use a maven-plugin, your project need to be build with maven. To be able to build a project with maven, you need at least a *pom.xml* file at the root of your project. If you don't know maven, I suggest you to read this : http://www.sonatype.com/resources/books/maven-by-example (free e-book introducing maven) – ben75 Aug 23 '14 at 17:29
0

There is a Jenkins Performance Plugin which provides better integration with Jenkins than Maven does.

However if you need to stick to Maven or don't have possibility to install the plugin see 5 Ways To Launch a JMeter Test without Using the JMeter GUI for Maven, Ant, command-line and Java instructions of kicking off a JMeter test.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
0

Yo can add "Execute Shell" build step for your Jenkins project with shell commands to run you JMeter Test Plan without UI. Something like this:

sh $jmeterdir/jmeter.sh -t $jmeterdir/HealthCheck.jmx  -n -j jmeter.log

In order to check results of JMeter Test Plan executing for making a decision about Build Failure/Success you can implement the following approach:
1. Add Simple Data Writer to your Test Plan and make it log errors only into some file
2. Create sh script which takes you error log as parameter and check number of lines in it. If number of lines not equal to 1 - it means that we have at least one error in error log - do "exit 1" - this fails build:

count=$(wc -l < BuildErrors.csv)
if test $count != "1" 
 then 
  echo "There are errors during test."
  exit 1 


3. Run this script from Jenkins "Execute Shell" build step

ViktorK
  • 1
  • 2
  • In order to help Jenkins make a decision on build status (success or failure) you can now use lightning: https://github.com/automatictester/lightning – automatictester Jul 24 '15 at 20:55