Cloud testing in k6 | Tech

Reading Time: 3 minutes

Hi Readers, In this blog, I will explore how to run a test script in the K6 cloud to visualise and analyse the results on the web app in real-time.

K6

Basically, 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. 

K6 cloud tests from the CLI

Running tests within the web app is helpful when getting a feel for the tool or building a proof of concept. However, many users will find great flexibility when using k6 to trigger cloud tests from the command line.

Reasons for triggering cloud tests from the k6 CLI include:

  • Storing test scripts in local version control.
  • Modularization of scripts for collaboration and easier maintenance.
  • Preference to work in your local environment.
  • Integrating testing in CI/CD pipelines.
  • Analyse and visualise the result.
  • UI output.

Instructions to follow K6 cloud

For visualisation and analysis of the result, we need to follow the step-

  1. Sign up for the K6 – Click on signup if you have an account, click on sign in

2. Write a script into the K6- Write a script and save it with any name like First.js

3. Login into the terminal- Before that, we need to copy a token from K6

4. In the terminal, write a command

5. After this, run the test script and upload the result
k6 run --o cloud First.js(File name)



6. In the cloud, we can see the output

When you send the results to the k6 Cloud with k6-out, data will be continuously streamed to the cloud. While this happens the state of the test run will be marked as Running. A test run that ran its course will be marked Finished. The run state has nothing to do with the test passing any thresholds, only that the test itself is operating correctly.

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

Thank you!!

References:

https://k6.io/docs/results-visualization/cloud/

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.