My first load testing with K6

Test life cycle

  • init: Declare global variable and import file or module.
  • setup: Set up test environment and generate shared data, run before the test and only run once
  • VU code: Implement test, running as many times as option setting.
  • teardown: Close test environment and send webhook notification when test finish, only run once.
Test life cycle

Let’s do it

  • URL
  • URLSearchParam
  • Rate : calculate value of matching condition and the value is percentage and non-zero.
  • Trend : calculate values with different statistics(min, max, average or percentiles).
  • executor (Required): Unique executor name. It has seven executor in official document.
  • startTime (Required): The point that the scenario start to execute. The default value is 0s.
  • startRate: Number of iterations execute per time unit during the test processing.
  • timeUnit: In the specific time, the test should achieve target of iterations or start rate value. The value is NOT changed during test run.
  • preallocatedVUs: Number of virtual users before the test run to presume the test resource.
  • maxVUs: Maximum number of virtual users during the test running.
  • stages: Array of the target iteration.
Result of testing
Visualization with k6 cloud




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium A hosted PaaS for generating Synthetic Data

CanTP — Transport Protocol, for CAN communication in AUTOSAR BSW.

WordPress High Availability On Google Cloud Headaches

SIPA Platform — Wordpress Cloud Platform

Using Cinemachine in 2D for Unity

Integration of Github , Git, Docker & Jenkins.

IoT Hub Interceptor In Azure

Laravel Basic | Soft Delete Example

Creating and Maintaining .NET Libraries: Lessons Learned

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Michelle Hung

Michelle Hung

More from Medium

What is OAuth 2.0

7 Tips for Designing Secure REST APIs

DynamoDB Global Secondary Index (GSI) | Java SDK

Test a low-code application