Create Jenkins Job for Load Testing

Learn how to create projects on Jenkins and configure Jenkins to run the Gatling test project that is hosted on any source management tool.

Now we have the necessary installations done for Jenkins and Gatling plugins. In this lesson, we will go through the steps to create a load test simulation job using Jenkins.

Creating a new item

Once we have the Jenkins running, we click on “New Item”.

That will take us to the following screen where we enter the project name and select “Freestyle project”. Let us name the project “gatling-simulation”, as an example.

Configuring the project

Configuring source code management

We will now configure the source code management URL from where the hosted code will be checked out (or cloned) to the Jenkins workspace.

For the demonstration, we are using github.com as our source code management tool for hosting our code.

We need to select “Git” and add “Credentials” if required.

We can also change the branch if we are going to use anything other than “master”, which is selected by default as shown in the above image.

Configuring build step

Under “Build”, go to the “Add build step” drop-down and select “Invoke Gradle Script” options.

Once that is done, the below screen will appear to enter the build command. Please fill it in accordingly.

Configuring Gatling simulation tracking

Under Post-build Actions, go to the “Add post-build action” drop-down and select the “Tracking a Gatling load simulation” option.

Once done, please ensure the “Post-build Actions” looks like this:

Once all configurations are set properly, click on the “SAVE” button, and we are all set to run our first Gatling simulation from Jenkins.

Triggering the Jenkins job.

Now we can click on the “Build Now” button to start the build.

Once the build completes, we should see a graph like the following image:

Additionally, we can configure to run the build periodically by setting a cron task. To do that, click on the “Configure” option and select “Build periodically” under “Build Triggers”. Add the cron expression like the following to run at 00:00 daily.

We can also change the time period per our needs.

Get hands-on with 1200+ tech skills courses.