Examples
Single Request
Example of one HTTP GET request.
HTTP Authentication and authorization
Scripting examples on how to use different authentication or authorization methods in your load test.
OAuth Authentication
How to load test APIs secured with OAuth on Azure Active Directory and Okta.
Correlating Tokens and Dynamic Data
Scripting examples to correlate dynamic data in your test script.
Data Parameterization
Scripting examples on how to parameterize data in a test script.
Parse HTML
Scripting examples parsing HTML content.
Filling and Submitting HTML Forms
Scripting example on how to handle HTML forms in a load test.
Cookies
Scripting examples on how you can interact with cookies during your load test, if required.
Data Uploads
Scripting examples on how to execute a load test that will upload a file to the System Under Test(SUT).
API CRUD Operations
This example covers the usage of different k6 APIs for API CRUD operations testing.
Generating UUIDs
Scripting example on how to generate UUIDs in your load test.
HTTP2
Information on how to load test HTTP/2.
Websockets
Scripting example on how to test WebSocket APIs.
SOAP
Load Testing SOAP API.
Transport Layer Security (TLS)
TLS is the mechanism through which encrypted connections can be established between clients and servers on the web and through which data can flow with integrity intact.
Generating realistic data using faker.js
Reference project demonstrating how to generate data with realistic traits at runtime using faker.js.
Crawl a web page
Stack overflow answer demonstrating how to crawl a web page.
Bundling and transpilation
Reference project demonstrating how to use webpack and babel to bundle node modules or transpile code to ES5.1+ for usage in k6 tests.
Functional testing
Use expect library for integration testing.
Track transmitted data per URL
How to track data sent and received for an individual URL.
Construct URLs with query parameters
How to use URL and URLSearchParams APIs to construct URLs.
Instant load increase
How to instantly increase the number of VUs or iterations
Distribute workloads across VUs
How to configure different amounts of traffic for different VU behaviors
Tutorials
Get started with k6
This tutorial provides some procedures for common real-life uses of k6.
8 basic tasks to learn k6
Challenges are great ways to learn. All the tasks in this blog provide a little context about particular k6 features.
k6 Learn
A set of modules to learn about performance testing principles, k6 foundations, and intermediate concepts.
Swagger/OpenAPI integration
How to generate a load test script out of an OpenAPI document.
Schedule k6 tests with cron
This tutorial will show you how to schedule k6 tests with cron to monitor the performance of your system.
Load test a GraphQL service
This post provides an example using k6 to load testing a GraphQL service.
Use TypeScript in k6 scripts
This repository provides a scaffolding project to start using Typescript in your k6 scripts.
Debug using a Web Proxy
How to configure k6 to send HTTP traffic through a web proxy for debugging k6 tests.
Distributed k6 tests on K8s
Deploy the k6 operator in your Kubernetes cluster to run distributed k6 tests.
Create a k6 extension
This short tutorial will walk you through the steps to build a k6 extension for Redis and use it in your k6 test.