The best tool in 2021, I came across was doing Load Testing using K6. Story behind it, I was recently looking into the options for load testing tools. On a previous project we had used Load-runner. That worked well, and the reports were good, but now that I’m on a new team, I wanted to see what was out there. I was looking for something with which we could write tests in a more familiar language.
Along with K6, The tools I came across were these:
All of these are open source by the way, and some have enterprise solutions.
It’s basically a github repo with a README and some instructions on how to install it, run it, etc.
Taking K6 for a toast
If you’re on a Mac, you can just
brew install k6
They also have a docker image which is also cool, but I went with brew for now.
I created a folder named
k6 on my computer.
I created a
script.js file and followed the documentation to get started.
You might notice that I have a
package.json file. I ran
yarn init to initialize my project here expecting that I would have to install packages. But evidently, brew-installing k6 was enough and these imports worked
Anyway…Now that I had created the
script.js file, all I had to do was run it.
$ k6 run script.js
Here, you can see that
vus (virtual users) is 1 by default, as is
If we want to up those numbers, we can pass them as options.
This time, I had k6 run with 10 virtual users, and hit the server for 30 seconds.
As we showcased, getting started with k6 load testing.
By using a methodical approach, starting small and applying known principles you can now get started with performance testing using k6 as well!
About the Author
Pawan Sinha is a blogger whose interests in writing blogs on a day to day issues for any engineer working for a software company. To discuss his work, He has a background in Testing/DevOps/Engineering/Cloud/AWS/GCP. His portfolio.