Skip to main content
Extensions can be used to extend the core k6 features to fit your performance-testing use cases. There are two main categories of extensions: official and community.

Official extensions

These are extensions owned and maintained by Grafana Labs, with support for a wide range of versions.

Protocol extensions

k6/x/mqtt

MQTT protocol support with event-driven architecture, QoS levels, and SSL/TLS

k6/x/redis

Redis database interaction with promise-based async API

k6/x/sql

SQL database testing for PostgreSQL, MySQL, SQLite, and more

Browser and chaos testing

k6 browser

Browser automation and end-to-end testing with Playwright-compatible APIs

xk6-disruptor

Chaos testing through fault injection in Kubernetes environments

Output extensions

xk6-output-prometheus-remote

Send metrics to Prometheus via remote write protocol

xk6-output-influxdb

Export metrics to InfluxDB time-series database

Community extensions

These are extensions developed by the community, with support for specific versions.
We’re working on a process for community folks to submit their extensions.

xk6-kafka

Apache Kafka producer and consumer for event streaming tests

xk6-faker

Generate realistic fake data for tests

xk6-websockets

Enhanced WebSocket support with additional features

xk6-dashboard

Real-time web-based dashboard for test execution
Many other extensions maintained by members of the k6 ecosystem are available on GitHub. These extensions aren’t maintained nor audited by Grafana Labs.

Using extensions

There are two ways to use extensions when running a k6 test script.

Automatic extension resolution

Official and community extensions can be used without additional configuration. They are automatically resolved and loaded by k6 when you import them in your test script. Example with xk6-faker:
import faker from 'k6/x/faker';

export default function () {
  console.log(faker.person.firstName());
}
Run your script normally:
k6 run script.js
For community extensions, enable them with an environment variable:
K6_ENABLE_COMMUNITY_EXTENSIONS=true k6 run test.js

Limitations

  • Only works with official and community extensions
  • Output extensions aren’t supported
  • Running scripts from stdin isn’t supported
  • Only files with extensions .js, .ts or .tar can be used

Disable automatic resolution

You can disable this feature by setting the environment variable:
K6_AUTO_EXTENSION_RESOLUTION=false k6 run test.js

Custom k6 binary

If you have developed your own k6 extension or want to use an extension that’s not available through automatic extension resolution, build a custom k6 binary. The process involves using the xk6 tool to compile k6 with your desired extensions included. Custom binaries give you the flexibility to incorporate any extension from the k6 ecosystem.
xk6 build \
  --with github.com/grafana/[email protected] \
  --with github.com/grafana/xk6-output-prometheus-remote
Refer to Build a Custom k6 Binary to learn how to create your own k6 binary with custom extensions.

Finding extensions

To discover more extensions:
1

Browse GitHub topics

Search for repositories tagged with xk6 on GitHub.
2

Check the k6 community

Visit the k6 Community Forum for discussions about extensions.
3

Review extension registries

Some extensions are listed in community-maintained registries.

Next steps

Build Custom Binary

Learn how to bundle extensions into k6

Create Extension

Build your own k6 extension

Protocol Extensions

Explore MQTT, Redis, and SQL extensions

xk6-disruptor

Try chaos testing with fault injection

Build docs developers (and LLMs) love