Skip to main content

Jmeter and Maven Chronos plugin

There are several different approaches to integrate JMeter and Maven. We needed to use one of them to integrate our JMeter test automation suite with our continuous integration server.

There are two plugins available:

  1. JMeter Maven Plugin
  2. Chronos Maven Plugin
I decided to use Chronos Maven plugin. It requires explicit installation of JMeter.

I've successfully configured pom.xml for running our test automation suite and reporting of the test results. You need to perform the following steps:
1. Install Apache Maven
2. Create pom.xml file and put it in a directory of your choice
3. Set your local JMeter installation directory path in jmeter.home in pom.xml file
4. Set the path to your JMeter script in pom.xml
5. Set assertions in pom.xml file if required (I didn't need this, so they are not present in the example below)
6. Create a JMeter project and copy it to test subdirectory of the directory where you stored pom.xml file. Your directory structure should be similar to the following example (target folder will be created automatically by Maven during the first test execution, it will contain raw JTL file and test reports in HTML format):

/test
/target
pom.xml
7. Run the targets manually or through your continuous integration server:
mvn clean (to clean the test results directory)
mvn chronos:jmeter (to run your Jmeter project)
mvn chronos:check (to check assertions given in pom.xml)
mvn chronos:report (to create html report with test results)

That's basically all you need. Maven will automatically download all required dependencies from Internet.
This is what my pom.xml file looks like: You also can configure your continuous integration server to run your tests. This is a part of my Hudson job configuration dealing with the test suite:

During test execution Chronos creates a target directory with results, copying both raw JTL file and HTML reports to this directory. So the first step in the job configuration must be clearing old results, the second step should be chronos:report goal which automatically executes JMeter test script and produces results in HTML format. It is also recommended to configure storage of artifacts so that we never lose test results from previous runs and keep the whole history.

Chronos produces eye-candy reports and the whole solution is very suitable for using with any continuous integration server if it supports Maven of course. Below you can see my test results as an example of the report it produces.

Summary statistics with all pages included in the table

Overall throughput

Per-request individual performance statistics

Response distribution histogram

Popular posts from this blog

Integrating TestRail and Gitlab CI/CD

Perhaps you are using Gitlab CI/CD at your project. Every project requires some test cases for regression testing, and Gitlab actually provides this feature, but it’s only available in Ultimate version that is more expensive. TestRail is another popular platform for managing your test suite that provides way more extensive capabilities and options than Gitlab’s own test case management feature. So the chances are that you are still willing to use TestRail for your acceptance and regression testing efforts. Why not combining the best of two worlds — the flexibility of Gitlab CI/CD and rich test case management capabilities of TestRail? In the following example I’ll demonstrate how this goal could be achieved with ease. Let’s assume that we need to create a new Milestone in TestRail that contains two test runs — the one with Acceptance tests, and another one with Regression tests. The step in your .gitlab-ci.yml Gitlab configuration file would look like this: This step is reading C...

Switching between keyboard layouts in Openbox (Arch Linux)

Switching between two (or more) keyboard layouts in Openbox DE is a task that's quite easy to accomplish, although it might not be so obvious as in other desktop environments. This solution was tested on Arch Linux. You just need to edit this file (assuming you want to switch between English and Ukrainian Phonetic layouts with Alt-Shift): /etc/X11/xorg.conf.d/01-keyboard-layout.conf Section "InputClass" Identifier "keyboard-layout" Driver "evdev" MatchIsKeyboard "yes" Option "XkbLayout" "us,ua(phonetic)" Option "XkbModel" "pc105" Option "XkbOptions" "grp:alt_shift_toggle" EndSection If you have Nvidia card, don't forget to edit /etc/X11/xorg.conf.d/20-nvidia.conf and change Driver from "kbd" to "evdev" in InputDevice section: Section "InputDevice" Identifier "Keyboard0" Driver "evdev" EndSection Y...

Using querySelector in Selenium WebDriver

Sometimes it's very helpful if we are able to click some element directly, by calling JavaScript click event. For example, this can be the case when the element is not visible, or not clickable, thus we cannot use native WebDriver methods. WebDriver driver = new FirefoxDriver(); JavascriptExecutor js = (JavascriptExecutor)driver; js.executeScript("document.querySelector('.pane .object_options .dropdown-toggle span').click();");