Getting started with sbt

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.

Login

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 sbt build tool, so make sure you have sbt configured and Java installed. You’ll use sbt 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.

Download samples

Extract the archive, then navigate to the sbt folder. This folder contains a basic Gatling simulation which can be used with FrontLine.

Check the sbt build configuration

You can check in the build.sbt and project/plugins.sbt files that this project uses a special sbt-frontline 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 sbt folder and execute the following command to create an artifact:

sbt test:assembly
sbt command

sbt 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).

Sidenav navigation

Click on the create button in order to create an artifact in FrontLine. Choose the name you want, then click save.

Create an artifact

You now have to upload the artifact you’ve generated earlier with Maven. Click on the icon.

Open upload modal

The artifact you’ve generated earlier is located here: frontline-samples/sbt/target/sbt-frontline-1.0.0.jar

Upload it to FrontLine, either by drag-and-dropping it to the modal, or by clicking on the modal to open the file manager.

Choose the generated artifact

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!

Start the upload

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).

Sidenav navigation

Click on the Create button in order to create an API Token in FrontLine. Make sure to grant either Artifacts or All permissions. Choose the name you want, then click Save.

Create an API Token

Make sure to save the API Token value somewhere, FrontLine will not be able to provide you with a token’s value later.

Save an API Token value

Now, go to the artifact repository you’ve created previously and copy its id.

Copy an Artifact's id

You can now upload your artifact, eg with curl:

curl -X PUT --upload-file <ARTIFACT_LOCAL_PATH> \
  "https://<DOMAIN>/api/public/artifacts/<ARTIFACT_ID>/content?filename=<ARTIFACT_FILE_NAME>" \
  -H "Authorization:<API_TOKEN>"

For example:

curl -X PUT --upload-file frontline-samples/sbt/target/sbt-frontline-1.0.0.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.

Return to simulation page

Now open the creation modal by clicking on the Add button.

Open the simulation modal

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.

General configuration

In the next step, choose the artifact you’ve created earlier and click on the “Next” button.

Artifact configuration

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.

Injection configuration

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.

Start the simulation

You can see the status of the simulation in the “Status” column, and the logs by clicking on the button.

Simulation status

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.

FrontLine 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.

Additional resources

You have successfully started load testing, you can read our documentation if you need more information about our product:

Edit this page on GitHub