This repository contains example k6 scripts based on a Udemy course. The scripts demonstrate various types of load testing and k6 features.
section1-intro/: Basic k6 script examplesSection2-k6-test-types/: Different types of load tests (smoke, load, stress, spike, soak, breakpoint)Section3-creating-test-scripts/: Advanced scripting (custom metrics, tags, groups, aborting tests, scenarios, etc.)Section4-BuildingAPIs/: Examples of making REST API calls with k6.section5-env-and-data/: Using environment variables and reading external data.section6-cloud/: Running tests in Grafana Cloud.section7-cli-and-output/: Useful k6 CLI options and dashboard features.section9-conclusions/: Browser testing and conclusions.
- Install k6.
- Run a script using:
For example:
k6 run path/to/script.js
k6 run Section3-creating-test-scripts/abort.js
- Update URLs in scripts as needed for your environment.
- Scripts are for educational purposes and can be adapted for real-world testing.
- k6 OSS Workshop - a K6 workshop with examples
- test-api.k6.io - this repo is deprecated but is used in section 4 of these scripts.
- A Quick Start Guide to Learning Performance Testing - This article is focused on general performance testing concepts and is not specific to k6.