In this blog, we shall discuss about the report generation through Gatling and combining Gatling Reports. As you may already know, when we run a Gatling test the report gets generated automatically.
However, you cannot compare the Gatling test report of two different tests in a single report unless you have the enterprise version of Gatling. I will try to explain an easy way of doing it without the enterprise version further in this blog.
Before staring, firstly we should have a basic idea about Gatling. So, in short, Gatling is an open-source load and performance testing framework which is based on Scala, Akka and Netty. It is to be used as a load testing tool for analyzing and measuring the performance of variety of services, with a focus on web Applications.
So moving ahead, considering that you know about Gatling and how to run the Gatling tests.
In order to generate a single report from two different reports, we need to add the dependency of Nuexo Gatling report which is available at maven repository.
You can find it from here https://mvnrepository.com/artifact/org.nuxeo.tools/gatling-report?repo=nuxeo-public-releases.
Furthermore, we shall know what Nuexo is.
Nuxeo provides a modular, extensible Java-based open-source software platform for enterprise content management and packaged applications. It is used for document management, digital asset management, and case management.
For more information you may visit http://www.nuxeo.com/.
Hence, proceeding with our main motive of the blog, we shall learn about how to setup the Nuxeo Gatling Report in out sbt project.
The library which I mentioned in Report Generation part contains two versions of it. 4.0 is the latest one(released in Oct 2019) and the other version is 1.0. Getting these versions compatible with the sbt or maven is the most difficult part. The dependency just doesn’t resolve itself automatically.
How to resolve this issue ?
What I did was I added the latest jar, you can directly use the sbt dependency instead, and added it as a dependency in the build.sbt or pom.xml. It depends, whether you are working with sbt or maven. I specified in the build.sbt itself that where and how to to find the jar in the system.
I have given the path as hard-coded data, therefore it may throw some warning when you run “sbt compile” or “mvn compile”. However, it will not result in a build failure.
You can download the latest jar from here as well https://maven-eu.nuxeo.org/nexus/#nexus-search;quick~gatling-report.
In short, work doesn’t end there. Firstly, you would have to configure the version of Gatling with the version of the jar which have you added as a dependency. In addition I am attaching the screenshot of build.sbt and plugins.sbt of my project.
libraryDependencies += "io.gatling.highcharts" % "gatling-charts-highcharts" % "3.0.0" % "test,it"
libraryDependencies += "io.gatling" % "gatling-test-framework" % "3.0.0" % "test,it"
addSbtPlugin("io.gatling" % "gatling-sbt" % "3.1.0")
It has been tested successfully with default Gatling 2.3.1, 2.1.7, 3.0.0 and 3.2.1 and 3.3.0 for maven. For sbt, the above-mentioned version is the compatible one.
At last, all we have to do is run the two different tests and collect their simulation.log files. So that, a combined report can be generated of these two simulations.
So, lets have a look at some sample reports.
By using the simulation.log files, you can create the following mentioned reports.
- Simulation Report – representation of response time, helps to pinpoint slow) requests.
- Differential Report – compare 2 bench results.
Again, here’s an example of what it looks like https://min.gitcdn.link/cdn/nuxeo/gatling-report/78a7b72c2f5594640d1f49cfc507b545c2804a6c/docs/diff-sim1-vs-sim2/index.html
- Trend Report – follow the trend of bench results over time.
refer to the link above to have a better picture of the trend report.
- Default CSV output –
For this, we just simply have to run our Gatling test, in case of sbt, follow the steps
gatling:test //for running all your simulation at once
gatling:testOnly //for running a single simulation class
$ mvn gatling:test
$ mvn gatling:testOnly //for running a single simulation class
To generate CSV output, as we have our Reports Generated, we can do so by using these following command.
$java -jar path/to/gatling-report-VERSION-capsule-fat.jar path/to/simulation.log
To combine these results of two test and to produce a single combined Report:-
You will have to submit two simulation files in order to produce a combined output.
$java -jar path/to/gatling-report-VERSION-capsule-fat.jar path/to/simulation.log [path/to/simulation2.log]
Also, you can submit zipped simulation files by using the command given below.
java -jar path/to/gatling-report-VERSION-capsule-fat.jar path/to/simulation.log.gz
Generate HTML report with Plotly charts:-
By using the “-o” keyword a report is generated.
While providing a single simulation log file, you can also generate the report.
$java -jar path/to/gatling-report-VERSION-capsule-fat.jar path/to/simulation.log -o /path/to/report/directory
Similarly if you are submitting two simulations files it creates a differential report:
$ java -jar path/to/gatling-report-VERSION-capsule-fat.jar path/to/ref/simulation.log path/to/challenger/simuation2.log -o /path/to/report/directory
Moreover, a trend report can also be created if you provide more than two simulation log files.
We can edit Poly charts online via https://plot.ly/.