CI/CD Integration in K6 with Gitlab

Reading Time: 3 minutes

Hi Readers, In this blog, I am going to explore, how to integrate k6 with help of Gitlab which is the DevOps software that combines the ability to develop, secure, and operate software in a single application. 


It is a free and open-source load testing tool for testing the performance of APIs. K6 has a goal-oriented testing mode, and users can define goals using Thresholds when building their tests. 


Gitlab is a web-based git repository that provides both open and private repositories. is a complete DevOps platform that enables professionals to perform all the tasks in a project—from project planning and source code management to monitoring and security.

Write a Test Script in k6

Write a script in K6 and save it as post.js

Integration with Gitlab

First of all, push the code into the GitLab repository which has written in k6.

After that create a GitLab-ci.yml file.his configuration file will trigger the CI to build whenever a push to the remote repository is detected. In the yml file add this code.

Click on the CI / CD -> Jobs section of the sidebar menu before that we need to add a runner so there are the following steps:-

  1. Select the Project
  2. Go to the Setting
  3. Click on CI/CD
  4. Under the CI/CD, expand the Runners
  5. Click on Specific Runners
  6. Click on Install Gitlab Runner
  7. On the left side, click on Official Linux Packages
  8. Copy the link and paste it into a local terminal
curl -L "" | sudo bash

9. After this, install the runner

sudo apt-get install gitlab-runner

10. After that click on Register a runner

11. For Linux,

sudo gitlab-runner register

12. For token, copy the token from

After adding the runner, it will display like this-

After adding the runner, go to the project page and click on the CI / CD -> Jobs section of the sidebar menu

I hope you enjoyed it and it helped you!! stay connected for more future blogs. 

Thank you!!


Written by 

Soniya is a QA consultant having experience of more than 3 years. She has experience with Performance testing, API testing and Automation testing(Selenium, Katalon, Cypress and k6). She is always eager to learn new and advanced concepts.