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.
K6
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
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.
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:-
- Select the Project
- Go to the Setting
- Click on CI/CD
- Under the CI/CD, expand the Runners
- Click on Specific Runners
- Click on Install Gitlab Runner
- On the left side, click on Official Linux Packages
- Copy the link and paste it into a local terminal
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | 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!!
References:
https://k6.io/blog/integrating-load-testing-with-gitlab/