sexta-feira, 21 de fevereiro de 2014

Installing Jekins and the JMeter plugin (Performance plugin)

Jekins
1. The installation procedure can be found at:

https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Red+Hat+distributions

2. Check if it is working:
[root@spike ~]# sudo service jenkins start
Starting Jenkins                                           [  OK  ]
The logs of Jekins run will be placed at:
/var/log/jenkins/jenkins.log
Find something like:
INFO: Jenkins is fully up and running
3. Accessing Jekins:

The general information can be found on:
https://wiki.jenkins-ci.org/display/JENKINS/Starting+and+Accessing+Jenkins
However, it is necessary to create a tunnel in the port 8080.
ssh -f root@spike -L 8080:127.0.0.1:8080 -N
Jekins must be available at:
http://127.0.0.1:8080/

JMeter plugins

The Jekins pages recommends using the Performance plugin instead of JMeter plugin.

https://wiki.jenkins-ci.org/display/JENKINS/Performance+Plugin
  1. The easiest way to install Jekins is by the Plugin Manager interface: http://127.0.0.1:8080/pluginManager/
  2. Go in the tab "Available" and find "Performance plugin" (figure below) 
  3. Go in "Download now and install after restart"
  4. After finish the donwload, restart jekins service: "sudo service jenkins restart"
  5. Install JMeter
    1. Download it:
      wget http://apache.mirror.iphh.net//jmeter/binaries/apache-jmeter-2.11.tgz
    2. Extract the files to :/var/lib/jenkins
    3. Rename (mv) apache-jmeter-2.11 as jmeter
  6. To check if it is installed it is necessary to create a new job.
    1. New Job
    2. Free-style software project
    3. Under Build, select Invoke Ant
    4. Select Advanced
    5. Target : all
      Path Build : /var/lib/jenkins/jobs/MY_PROJECT_NAME/build.xml
      Properties : jmeter.dir=/var/lib/jenkins/jmeter (reference to step 5.c)
    6. Down in Post-build Actions check the Publish Performance test result report checkbox
    7. Add a new report box and choose JMeter
    8. Set the branch to build to JMeter
      For Report files specify **/*.jtl
  7. Add the build.xml at the root of the job folder (/var/lib/jenkins/jobs/MY_PROJECT_NAME/). At the end I added a build.xml file.
  8. Under the job folder (/var/lib/jenkins/jobs/MY_PROJECT_NAME/), create the following directory structure (the workspace folder and all it subfolder have to be in chmod 777 "chmod -R 0777 ./*").
    +scripts
    +workspace
    ++results
    ++++jtl
    ++++html
  9. In the scripts folder upload the JMeter scripts files *.jmx





Usefull references

http://www.theserverlabs.com/blog/2009/04/23/performance-tests-with-jmeter-maven-and-hudson/
http://jlorenzen.blogspot.de/2008/03/automated-performance-tests-using.html
http://neyto.blogspot.de/2013/02/install-jenkins-with-jmeter-performance_2208.html


Build xml:









   
       
   

    name="jmeter"
    classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask"
    classpathref="ant.jmeter.classpath" >


   
   
   
   


             jmeterhome="${jmeter-home}"
         resultlogdir="workspace/results/jtl">
        
   




   
   



            classpathref="xslt.classpath"
        basedir="workspace/results/jtl"
        destdir="workspace/results/html"
        includes="*.jtl"
        style="${jmeter-home}/extras/jmeter-results-detail-report_21.xsl">