Documentation Index
Fetch the curated documentation index at: https://grafana_com_website/llms.txt
Fetch the complete documentation index at: https://grafana_com_website/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: /docs/k6/next/extensions/run.md (append .md) or send Accept: text/markdown to /docs/k6/next/extensions/run/. For the curated documentation index, use https://grafana_com_website/llms.txt. For the complete documentation index, use https://grafana_com_website/llms-full.txt.
This is documentation for the next version of Grafana k6 documentation. For the latest stable release, go to the latest version.
Run a test with extensions
There are two different ways to run your k6 test script depending on the k6 extension you want to use: using the automatic extension resolution, or building a custom k6 binary.
Before you begin
- Install k6 v1.2.0 or higher.
Use automatic extension resolution
It’s as easy as importing them. Example with xk6-faker:
import faker from 'k6/x/faker';
export default function () {
console.log(faker.person.firstName());
}Then, you can run your script as usual, and k6 automatically detects the extension and loads it:
k6 run script.jsShell tab-completion also triggers automatic extension resolution. When you press Tab after typing an extension import path, k6 provisions the extension if it isn’t already available.
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,.tsor.tarcan be used.
Disable automatic extension resolution
You can disable this feature by setting the environment variable K6_AUTO_EXTENSION_RESOLUTION to false. If provided, the previous example
fails because k6 can’t load the extension dynamically.
K6_AUTO_EXTENSION_RESOLUTION=false k6 run test.jsUse extensions with a custom k6 binary
To run other extensions (including ones you create), you need to build a custom k6 binary with xk6.
You can do this locally with Go or use the xk6 Docker image.
xk6 build \
--with github.com/grafana/xk6-sql@v0.0.1 \
--with github.com/grafana/xk6-output-influxdbdocker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build \
--with github.com/grafana/xk6-sql@v0.0.1 \For more details, refer to:
Was this page helpful?
Related resources from Grafana Labs

