APIs load testing using K6

APIs load testing using K6

Load testing

  • Validate reliability under expected traffic;
  • Discover bottlenecks and system limits under unusual traffic.
  • What flows or components do you want to test?
  • How will you run the test?
  • What criteria determine acceptable performance?
  • Smoke test: Verify the system functions with minimal load.
  • “Average” load test: Discover how the system functions with typical traffic.
  • Stress test: Discover how the system functions with the load of peak traffic.
  • Spike test: Discover how the system functions with sudden and massive increases in traffic.
  • Breakpoint test: Progressively ramp traffic to discover system breaking points.
  • Soak test: Discover whether or when the system degrades under loads of longer duration.
  • Script the test: Write user flows, parameterize test data, and group URLs.
  • Assert performance and correctness: Use Checks to assert system responses and use Thresholds to ensure that the system performs within your SLOs.
  • Model and generate load: Model the workload that’s appropriate to your test goals.
  • Iterate over your test suite: Over time, you’ll be able to reuse script logic and run tests with a wider scope or as a part of your automated testing suite.

K6

K6 Installation

Create test suite

  • Options (configuration)
  • Setup (Initializations)
  • Test Cases

2. Setup

3. Test Scenario

Execute Test Cases

Test Results

k6 load-test result

K6 Results Metrics

Conclusion

References