Integrate Load Testing in your build process with JMeter, UbikLoadPack and Maven

on 23 December 2015 CI, CONTINUOUS INTEGRATION, DEVOPS, GWT, JMETER, LOAD_TESTING, MAVEN, PERFORMANCE, PRODUCTIVITY and Tags: , , , , , , , , , , with 0 comments

Integrate Load Testing in your build process with JMeter, UbikLoadPack and Maven:

Edit 15 th january 2019: This post was using version 1.10.1 which is outdated. For an up to date blog about version 2.8.3 of jmeter-maven-plugin, read this. Integrating Load Testing in your Continuous Integration (CI) process has many benefits:
  • Constant check of the performances of the application
  • Securing continuous delivery in production
  • Early detection of performance problems or performance regressions
  • Automating the process
In this blog we will see how you easily configure your GWT RPC project to run load tests using:
  • Maven : the well known build tool
  • Apache JMeter : the Open Source reference for Load Testing
  • Ubik Load Pack Gwt Plugin : Our plugin for load testing easily and realistically GWTRPC based applications
Note this approach can also be followed for our other plugins:
  • Video Streaming (HLS, MPEG-DASH, HSS, HDS)
  • Auto-correlator
  • Java Serialization
  • Flex AMF

Components used:

jmeter-maven-plugin

To run the JMeter load test we will use the third party jmeter-maven-plugin by Lazerycode. This plugin allows you to configure and run easily any JMeter test plan from Maven. It is very easy to add any plugin or dependency as we will see in next step.

Ubik Load Pack GWT Plugin

To load test our GWT RPC application we will use our GWT plugin for JMeter.

Setting Up your project:

Setting up is very easy, just amend your pom.xml file with the following block: In the properties block we first add some properties that we will use below: <properties> ... <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <projectJmeterFolder>${basedir}/src/test/jmeter</projectJmeterFolder> <projectResourceFolder>${basedir}/src/test/resource</projectResourceFolder> <testFile>demo.jmx</testFile> ... </properties> In the build section we add: <build> <plugins> <plugin> <groupId>com.lazerycode.jmeter</groupId> <artifactId>jmeter-maven-plugin</artifactId> <version>1.10.1</version> <configuration> <overrideRootLogLevel>INFO</overrideRootLogLevel> <suppressJMeterOutput>false</suppressJMeterOutput> <ignoreResultFailures>true</ignoreResultFailures> </configuration> <executions> <execution> <id>jmeter-tests</id> <phase>verify</phase> <goals> <goal>jmeter</goal> </goals> <configuration> <propertiesJMeter> <jmeter.save.saveservice.response_data>false</jmeter.save.saveservice.response_data> <jmeter.save.saveservice.samplerData>false</jmeter.save.saveservice.samplerData> <jmeter.save.saveservice.requestHeaders>true</jmeter.save.saveservice.requestHeaders> <jmeter.save.saveservice.url>true</jmeter.save.saveservice.url> <jmeter.save.saveservice.responseHeaders>true</jmeter.save.saveservice.responseHeaders> <ULP.gwt.licensepath>/data/ubik/ulp/licenses/trials/ubikloadpack/ubik-gwt-plugin.license</ULP.gwt.licensepath> </propertiesJMeter> <testFilesIncluded> <jMeterTestFile>${testFile}</jMeterTestFile> </testFilesIncluded> <jmeterPlugins> <plugin> <groupId>com.ubikingenierie.ubikloadpack.gwt</groupId> <artifactId>ubik-jmeter-gwt-plugin-above2</artifactId> </plugin> </jmeterPlugins> </configuration> </execution> </executions> <dependencies> <dependency> <groupId>com.ubikingenierie.ubikloadpack.gwt</groupId> <artifactId>ubik-jmeter-gwt-plugin-above2</artifactId> <version>4.1.0</version> </dependency> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-user</artifactId> <version>2.7.0</version> </dependency> <dependency> <groupId>com.edgenius</groupId> <artifactId>geniuswiki-gwtserver</artifactId> <version>3.23</version> </dependency> <dependency> <groupId>com.edgenius</groupId> <artifactId>geniuswiki-serpol</artifactId> <version>3.23</version> </dependency> </dependencies> </plugin> </plugins> </build> Let’s detail each part of the configuration:

GWT Plugin configuration

Configuring UbikLoadPack plugin is just about adding it as a dependency and configuring its license.

Add it as a plugin

In the configuration section of <execution> block just add: <jmeterPlugins> <plugin> <groupId>com.ubikingenierie.ubikloadpack.gwt</groupId> <artifactId>ubik-jmeter-gwt-plugin-above2</artifactId> </plugin> </jmeterPlugins>

Then add it as a dependency

<dependencies> <dependency> <groupId>com.ubikingenierie.ubikloadpack.gwt</groupId> <artifactId>ubik-jmeter-gwt-plugin-above2</artifactId> <version>4.1.0</version> </dependency>

Install the plugin in your Maven repository

Run this command line using maven install plugin: mvn install:install-file -Dfile=/data/ubik/ulp/ulp-packages/gwt/ulp_gwt-plugin-4.1.0/lib/ext/ubik-jmeter-gwt-plugin-above2.jar -DgroupId=com.ubikingenierie.ubikloadpack.gwt -DartifactId=ubik-jmeter-gwt-plugin-above2 -Dversion=4.1.0 -Dpackaging=jar

Finally configure the license key

Add as a child of plugin > executions > configuration > propertiesJMeter: <ULP.gwt.licensepath>path to folder containing the ubik-gwt-plugin.license file/ubik-gwt-plugin.license</ULP.gwt.licensepath>

Application configuration

Add under dependencies of the jmeter-maven-plugin plugin the dependencies used by your test, you will at least have:
  • The GWT framework in the version used by your application
  • The JARs of your application used by the communication layer. The plugin will help you find the required ones during the scripting phase. In our case it consist of edgenius geniuswiki jar
  • The JARs that contains the serialization policy files (*.gwt.rpc) that the plugin generates for you
<dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-user</artifactId> <version>2.7.0</version> </dependency> <dependency> <groupId>com.edgenius</groupId> <artifactId>geniuswiki-gwtserver</artifactId> <version>3.23</version> </dependency> <dependency> <groupId>com.edgenius</groupId> <artifactId>geniuswiki-serpol</artifactId> <version>3.23</version> </dependency> Of course ensure all the custom JARs are in maven repository either through your application build process or using maven install plugin as per the previous example.

Customize JMeter configuration

You can customize the behaviour of the plugin and of JMeter in plugin > configuration element, that’s what we do through: <configuration> <overrideRootLogLevel>INFO</overrideRootLogLevel> <suppressJMeterOutput>false</suppressJMeterOutput> <ignoreResultFailures>true</ignoreResultFailures> </configuration> And also customize jmeter by overriding any of JMeter properties in plugin > executions > execution > configuration > propertiesJMeter, that’s what we do through: <propertiesJMeter> <jmeter.save.saveservice.response_data>false</jmeter.save.saveservice.response_data> <jmeter.save.saveservice.samplerData>false</jmeter.save.saveservice.samplerData> <jmeter.save.saveservice.requestHeaders>true</jmeter.save.saveservice.requestHeaders> <jmeter.save.saveservice.url>true</jmeter.save.saveservice.url> <jmeter.save.saveservice.responseHeaders>true</jmeter.save.saveservice.responseHeaders> <ULP.gwt.licensepath>/data/ubik/ulp/licenses/trials/ubikloadpack/ubik-gwt-plugin.license</ULP.gwt.licensepath> </propertiesJMeter>

Running the test

We’re now ready to run the test: mvn clean verify Here is the output: [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building ulp-demo-maven 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ulp-demo-maven --- [INFO] Deleting /data/ubikloadpack/workspace/demo-ulp-maven/target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ulp-demo-maven --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /data/ubikloadpack/workspace/demo-ulp-maven/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ulp-demo-maven --- [INFO] No sources to compile [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ulp-demo-maven --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /data/ubikloadpack/workspace/demo-ulp-maven/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ ulp-demo-maven --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ ulp-demo-maven --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ ulp-demo-maven --- [WARNING] JAR will be empty - no content was marked for inclusion! [INFO] Building jar: /data/ubikloadpack/workspace/demo-ulp-maven/target/ulp-demo-maven-1.0-SNAPSHOT.jar [INFO] [INFO] --- jmeter-maven-plugin:1.10.1:jmeter (jmeter-tests) @ ulp-demo-maven --- [INFO] [INFO] ------------------------------------------------------- [INFO] P E R F O R M A N C E T E S T S [INFO] ------------------------------------------------------- [INFO] [INFO] [info] [debug] JMeter is called with the following command line arguments: -n -t /data/ubikloadpack/workspace/demo-ulp-maven/src/test/jmeter/demo.jmx -l /data/ubikloadpack/workspace/demo-ulp-maven/target/jmeter/results/20151223-demo.jtl -d /data/ubikloadpack/workspace/demo-ulp-maven/target/jmeter -L INFO -j /data/ubikloadpack/workspace/demo-ulp-maven/target/jmeter/logs/demo.jmx.log [info] Executing test: demo.jmx [info] This plugin is the sole property of SAS UBIK-INGENIERIE and subject to licensing, using it without explicit company authorization will expose you to lawsuits. [info] License granted to Demo (Trial License for 3 VUs requested by Ubik support@ubikloadpack.com ) for ubik-gwt-plugin by SAS UBIK-INGENIERIE for 3 VUs until:2016.01.04, using it in another customer context is forbidden [info] This plugin is the sole property of SAS UBIK-INGENIERIE and subject to licensing, using it without explicit company authorization will expose you to lawsuits. [info] License granted to Demo (Trial License for 3 VUs requested by Ubik support@ubikloadpack.com ) for ubik-gwt-plugin by SAS UBIK-INGENIERIE for 3 VUs until:2016.01.04, using it in another customer context is forbidden [info] Creating summariser <summary> [info] Created the tree successfully using /data/ubikloadpack/workspace/demo-ulp-maven/src/test/jmeter/demo.jmx [info] Starting the test @ Wed Dec 23 21:57:25 CET 2015 (1450904245935) [info] Waiting for possible shutdown message on port 4445 [info] summary + 9 in 4s = 2.2/s Avg: 204 Min: 1 Max: 402 Err: 0 (0.00%) Active: 1 Started: 1 Finished: 0 [info] summary + 40 in 12.3s = 3.3/s Avg: 624 Min: 111 Max: 6387 Err: 2 (5.00%) Active: 0 Started: 1 Finished: 1 [info] summary = 49 in 16.3s = 3.0/s Avg: 547 Min: 1 Max: 6387 Err: 2 (4.08%) [info] Tidying up ... @ Wed Dec 23 21:57:42 CET 2015 (1450904262330) [info] ... end of run [info] Completed Test: demo.jmx [INFO] [INFO] Test Results: [INFO] [INFO] Tests Run: 1, Failures: 0 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 21.824 s [INFO] Finished at: 2015-12-23T21:57:42+01:00 [INFO] Final Memory: 11M/81M [INFO] ------------------------------------------------------------------------ After the run, the results are generated in target/jmeter/results and the jmeter logs in target/jmeter/logs.

NDLR

Now you’re ready to load test your application with JMeter within the Continuous Integration process using any of our plugin or third party plugins like JMeterPlugins. Add this to Jenkins and you can schedule your tests on a daily basis or after every commit or whatever your like.

About author:

Philippe Mouawad is a developer, committer and member of the JMeter Project Management Committee at Apache. He is also the co-author of the book Master JMeter : from load testing to DevOps. He currently works as an Architect and technical expert for Ubik-Ingenierie where he leads among other things the development of UbikLoadPack a set of Commercial Plugins for Apache JMeter allowing to load test different protocols like MPEG-DASH, Http Live Streaming (HLS), HSS, HDS, GWT, JavaSerialization, Oracle applications.

About UbikLoadPack: