Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Iframe
frameborder0
height250
width700
src
Wiki Markup
{iframe:src=http://update.sonarsource.org/plugins/jmeter-confluence.html

Your browser does not support iframes.

Compatibility with Sonar

Plugin

0.1

0.2

Sonar

2.4+

2.4+

Quick guide

  • Install plugin in SONAR (copy to extensions/plugins/) and restart SONAR server.
Info
New feature in plugin
|width=700|height=250|frameborder=0}
Your browser does not support iframes.
{iframe}

Description / Features

This plugin collects performance tests results from Apache JMeter. Apache JMeter may be used to test performance both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types. You can use it to test your server/script/object behavior under heavy concurrent load.

If it is the first time you have heard of Apache JMeter then you should try it before using this plugin.

The following metrics are recorded in SonarQube:

  • Duration (in seconds)
  • Error density (number of errors / number of requests * 100)
  • Average response time for requests
  • Average response time for transactions
  • Successful requests per minute
  • Successful requests per minute and user
  • Response time deviation for requests
  • Response time deviation for transactions
  • Number of requests
  • Number of transactions
  • Successful transactions per minute
  • Successful transactions per minute and user
Include Page
Include - Plugin Installation
Include - Plugin Installation

Quick Guide

Info

New feature in version 0.2
There is now a jmeter-report-server embedded inside the sonar plugin, and there is a new configuration option (Local jtl file) where you can set a jtl file path, local to the sonar SonarQube server. If this option is set, no remote jmeter report server if is used, and jmeter test results are taken from the local file.

If you want to use JMeter Report Server then:

...

...

  • > java -Dtestconfig.name.jtlpath=/path/to/file.jtl -jar jmeter-report-server.jar
    
  • Go to

...

  • SonarQube system settings

...

  • and set host and port for your JMeter Report Server.
  • Go to your project settings and set the "configuration key" (this must be the same you set in your property name).

...

  • Run mvn sonar:sonar
  • Add JMeter widget to your dashboard and your JMeter metrics will be

...

  • displayed (smile)
Info

JTL files must be provided as a result of JMeter tests.
JMeter Report Server is just to make JTL files available remotely.

Description / Features

This plugin collects performance tests results from Apache JMeter. Apache JMeter may be used to test performance both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types. You can use it to test your server/script/object behavior under heavy concurrent load.

If it is the first time you hear from Apache JMeter then you should try it before using this plugin.

The following metrics are included in Sonar:

  • Duration (in seconds)
  • Error density (number of errors / number of requests * 100)
  • Average response time for requests
  • Average response time for transactions
  • Successful requests per minute
  • Successful requests per minute and user
  • Response time deviation for requests
  • Response time deviation for transactions
  • Number of requests
  • Number of transactions
  • Successful transactions per minute
  • Successful transactions per minute and user

This is an example of the widget you will see in Sonar:

Image Removed

Usage & Installation

JMeter

...

Usage 

JMeter

JMeter installation is very easy. JMeter is developed with Java and it is distributed as a compressed file.

...

You can also take a look at this video tutorial to see how to record a test with JMeter:

Widget Connector
urlhttp://www.youtube.com/watch?v=3DC8jELL4So

SONAR JMeter The SonarQube JMeter plugin uses the results datafile generated by JMeter (file with extension .JTL) so remember to configure your test plan to store the results in a single JTL file.

In this video we show you how to set this JTL file:

Widget Connector
urlhttp://www.youtube.com/watch?v=rj6-x1v3gto

JMeter Report Server

JMeter Report Server is a server that generates performance reports from JMeter results. SONAR JMeter The SonarQube JMeter Plugin uses this server to get the performance metrics from the projects.

It must be installed on the same machine with JMeter tool. The server will read the JTL files to get provide all the data to SONARSonarQube.

JTL files must be provided as a result of JMeter tests. The JMeter Report Server is needed just to make JTL files available remotely.

...

JMeter Report Server needs to know where the JTL files are located. You can set your test configuration when running the server through command line system properties:

Code Block

java -Dtestconfig.name1.jtlpath=/path/to/file1 -jar jmeter-report-server.jar

where name is the test configuration that you will use in SONAR SonarQube JMeter Plugin project settings.

Or you can also set this location by creating a property file "jmeter-report-server.properties" with all your test configurations:

Code Block

testconfig.name1.jtlpath=/path/to/file1
testconfig.name2.jtlpath=/path/to/file2
...
testconfig.nameM.jtlpath=/path/to/fileN

This is useful is if you have multiple projects in your JMeter environment and you want to manage all your tests with a single JMeter Report Server.

Port and maxConnections are now configurable properties and they can be set as system properties (using -D in the start command) or as normal properties in the jmeter-report-server.properties file as shown below.

Code Block

# Using default port
port=4444

# Unlimited connections
maxConnections=0

Here you have a test configuration example:

Code Block

testconfig.iceweb.jtlpath=/home/carlos/jmeter_work/iceweb.jtl

...

"iceweb" will be the name for your test configuration. SONAR  SonarQube plugin settings will use that name.

...

You can start the server with this command:

Code Block

java -Dtestconfig.name1.jtlpath=/path/to/file1 -jar jmeter-report-server.jar

NOTE: replace "jmeter-report-server.jar" with the name of the file downloaded and testconfig property with your project name and the path to the JTL file.

...

SonarQube JMeter Plugin

Installation

  1. Copy the jar into /extensions/plugins/ directory
  2. Restart Sonar server

Configuration

This video shows how to configure JMeter plugin in SONARSonarQube:

Widget Connector
urlhttp://www.youtube.com/watch?v=aOK7pOLJxx0

  • Project must exist in

...

  • SonarQube before using JMeter plugin
  • JMeter Report Server must be up and running if using remote configuration, and it must have a test configuration with the same name you set in

...

  • SonarQube JMeter plugin settings.
  • JTL file must exist in the host that is running JMeter Report Server.

Since version 0.2 version, there is a jmeter-report-server embedded inside the sonar SonarQube  JMeter plugin, and there is a new configuration option (Local jtl file) where you can set a jtl file path, local to the sonar server. If this option is set, no remote jmeter report server if is used, and jmeter test results are taken from the local file.

Now it is possible to configure units of time in your global or project settings. You can set seconds, minutes or hours.

Add the JMeter widget to your dashboard and next time you run "mvn sonar:sonar" you will retrieve performance metrics from JMeter, and SONAR will show them.

Usage with maven-jmeter-plugin

Since version 0.2 release , the plugin can be used together with Maven JMeter Plugin and Cargo to perform the tests and collect performance metrics in just one maven Maven goal:

Code Block

mvn cargo:start org.apache.jmeter:maven-jmeter-plugin:jmeter sonar:sonar

You have to configure your project to be able to do that:

  • Include your jmeter.properties and all your JMeter tests in "src/test/jmeter"
  • Configure your new maven plugins in your project and set "jmeter-reports" as the your report directory.
Code Block

<!-- Plugin to launch your JMeter tests in Maven -->
<plugin>
    <groupId>org.apache.jmeter</groupId>
    <artifactId>maven-jmeter-plugin</artifactId>
    <version>1.0-GA</version>
    <configuration>
        <reportDir>${project.build.directory}/jmeter-reports</reportDir>
    </configuration>
</plugin>

<!-- Plugin to start a container and be able to run your webapp and perform your JMeter tests 
     This example uses Tomcat 7 as the container. -->

<plugin>
	<groupId>org.codehaus.cargo</groupId>
	<artifactId>cargo-maven2-plugin</artifactId>
	<version>1.1.0</version>
	<configuration>
		<container>
			<containerId>tomcat7x</containerId>
			<zipUrlInstaller>
				<url>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.12/bin/apache-cat-7.0.12.zip</url>
			</zipUrlInstaller>
		</container>
	</configuration>
</plugin>

To get sonar-jmeter-plugin working in maven side, there must not be any configuration values set in Sonar in SonarQube (all of them must be blank).

Known

...

Limitations

  • You can only use one JTL file per project.

...

Change Log

JIRA Issues
anonymoustrue
title

...

Version 0.2
height190
renderModestatic
width900
columnstype;key;summary;priority

...

urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+SONARPLUGINS+AND+fixVersion+%3D+%22JMETER-0.2%22&tempMax=1000

 

JIRA Issues
anonymoustrue
title

...

Version 0.1
height190
renderModestatic
width900
columnstype;key;summary;priority

...

urlhttp://jira.codehaus.org/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+SONARPLUGINS+AND+fixVersion+%3D+%22JMETER-0.1%22&tempMax=1000