We have created a plugin for RedLine13 users to execute Gatling tests using SBT + Java.
Gatling Older SBT-Plugin
If you are using the older Gatling SBT-Plugin, you can package your JAR to be complete with everything required to run the test.
sbt "it:assembly"
After the package is created, you can test locally
java -jar target/scala-2.11/gatling-tests-as-jar-1.0.jar -s example.SomeGatlingSimulation
A community member provided an example project that can be used to model here. After we have used SBT to package our JAR, we can take the generated JAR file and scale this on RedLine13.com. Executing Gatling Tests via SBT + Java supports the same features as running Gatling tests via Simulations. You can aggregate the results and generate a full Gatling report + RedLine13 reports.
Gatling New SBT-Plugin
The newer Gatling-SBT Plugin has a different mechanism for packaging your test, which only includes the test scenarios and required resources.
sbt Gatling/enterprisePackage
The output jar file will be located in the directory target/gatling/<artifactId>-gatling-enterprise-<version>.jar.
This JAR file will be the one to use when executing your test on RedLine13. We have tested this using the gatling-sbt-demo project. Executing Gatling Tests via SBT + Java supports the same features as running Gatling tests via Simulations. You can aggregate the results and generate a full Gatling report + RedLine13 reports.
Getting Started With The Plugin
To begin using the plugin, log into your RedLine13 account, locate the “Account” tab, and navigate to “Your Plugins”
Next, install the SBT + Java Plugin by clicking the “+”. You can verify the instillation by navigating to the “Installed” tab:
Once the plugin is successfully installed, navigate back to your dashboard home, click “Start Test”, and then begin to create a new Gatling test. Upload the simulation that you generated in SBT, and be sure to click the “Save the response output from individual tests and calculate percentiles” (important: this will enable aggregated Gatling reports):
You will then want to scroll down and locate the “Advanced Gatling Test Options” tab. Here we will activate the plugin by checking the box next to “SBT with Java”. You will also want to inject the appropriate simulation class and any other parameters. Once this has been completed, you can then run your test.
Important: If using the newer Gatling-SBT with the command */enterprisePackage make sure to select the checkbox.
Once your test has been completed, you can view the results inside RedLine13. To access the generated Gatling report, navigate to the “Output Files” tab. Here you will find your generated Gatling report that you can download.
The Gatling report will be downloaded as a .TAR. Extract the files, navigate to the extracted “Report-Files” folder, and find your generated Gatling report (it will be a .HTML). Now you can simply drag the .HTML into your browser of choice and can view your Gatling report:
With this plugin, we now have three ways to execute Gatling Tests:
- Upload Simulation file
- Create and execute via Maven project
- Create Assembly via SBT and execute via the java command
Additional Resources:
RedLine13 GitHub Documentation