Getting started with Gradle
In this tutorial, we’ll describe every step you need to take in order to have a working basic configuration on FrontLine.
Once you connect to the instance provided by Gatling Corp, you’ll see this page. You need to signup with the Github account you provided Gatling Corp.
There are multiple ways to create a Gatling artifact, which will be used by FrontLine to launch a run. You can use either a build tool (Maven, Sbt, Gradle) or the Gatling bundle.
In this tutorial, we’ll use the Gradle build tool, so make sure you have Gradle configured. You’ll use Gradle from the terminal, but you can also do it easily with an IDE like IntelliJ.
Download the sample Gatling simulation
Once you’ve connected to FrontLine, you’ll be redirected to the simulations page. For this tutorial, we’ll use the samples included with FrontLine. Click on the Download samples button.
Extract the archive, then navigate to the gradle folder. This folder contains a basic Gatling simulation which can be used with FrontLine.
Check the Gradle build configuration
You can check in the
build.gradle files that this project uses a special
io.gatling.frontline.gradle plugin to generate the artifact in the proper format.
If you have some existing projects you want to use, you’ll have to configure this plugin there too. If so, please have a look at the Reference Documentation for more information.
Generate the artifact
Open a terminal in the gradle folder and execute the following command to create an artifact:
Gradle will download the necessary dependencies and package your simulation. That’s it, you’ve created your first Gatling artifact!
Upload the artifact to FrontLine
Option 1: Manual Upload
Let’s get back to FrontLine. To navigate to the artifacts page, click on the icon on the Sidenav (navigation bar on the left of the screen).
Click on the create button in order to create an artifact in FrontLine. Choose the name you want, then click save.
You now have to upload the artifact you’ve generated earlier with Maven. Click on the icon.
The artifact you’ve generated earlier is located here:
Upload it to FrontLine, either by drag-and-dropping it to the modal, or by clicking on the modal to open the file manager.
You now have to click on the Upload button to upload it to FrontLine. After a few seconds, the upload will be complete, and your artifact will be ready to use!
Option 2: API Upload
Instead of manually uploading the artifact with the WebUI, you can also upload your artifact programmatically. The option is also useful if you want to automate this step.
First, you need to create an API Token as our REST API is secured.
Back in FrontLine, click on the icon on the Sidenav (navigation bar on the left of the screen).
Click on the Create button in order to create an API Token in FrontLine.
Make sure to grant either
Choose the name you want, then click Save.
Make sure to save the API Token value somewhere, FrontLine will not be able to provide you with a token’s value later.
Now, go to the artifact repository you’ve created previously and copy its id.
You can now upload your artifact, eg with
curl -X PUT --upload-file <ARTIFACT_LOCAL_PATH> \ "https://<DOMAIN>/api/public/artifacts/<ARTIFACT_ID>/content?filename=<ARTIFACT_FILE_NAME>" \ -H "Authorization:<API_TOKEN>"
curl -X PUT --upload-file frontline-samples/gradle/build/libs/gradle.jar \ "https://yourorg.beta.gatling.io/api/public/artifacts/8ba9511a-0376-409e-a4f3-a8d8f85624c7/content?filename=artifact.jar" \ -H "Authorization:jAsAFAWes-Lif6BaMYN0JngAUCzdRw_dS1oUodYUvsdi8JwE0m3OzF_SV1rwkND8q"
Create a FrontLine simulation
Now that you’ve created your artifact on FrontLine, it is time to create a simulation. A simulation is a configuration of a Gatling test on FrontLine.
Go back to the main page by clicking on the Gatling icon of the navbar.
Now open the creation modal by clicking on the Add button.
Enter “my simulation” as the name, choose “Default” as the team and “frontline.sample.BasicSimulation” as the class name. You can then click on the “Next” button.
In the next step, choose the artifact you’ve created earlier and click on the “Next” button.
In this last step, you’ll be asked where you want the injection to take place. Please select your favorite location, eg “US east - North Virginia”, and click on the “Save” button.
That’s it, you’ve created your first simulation on FrontLine!
Start load testing!
You’re now ready to start load testing on FrontLine. To start the simulation you’ve created previously, click on the icon.
You can see the status of the simulation in the “Status” column, and the logs by clicking on the button.
You also have access to advanced metrics about your run, even while the simulation is still running. Click on the button to see the reports.
You will find here every information you may need to analyze your run. Take some time to interact with the graphs and change tabs.
You have successfully started load testing, you can read our documentation if you need more information about our product:
- FrontLine documentation
- Documentation about the creation of an artifact
- Documentation about how to use the FrontLine reports