No results for

Powered byAlgolia

k6 Extensions

Expand the potential use cases for k6.

Quickstart

Custom k6 builds

With k6 extensions, you can create custom k6 binaries to support your specific reliability-testing needs.

Currently, k6 supports two ways to extend its native functionality:

  • JavaScript extensions

    Extend the JavaScript APIs available to your test scripts. Add support for new network protocols, improve performance compared to equivalent JS libraries, or add features.

  • Output extensions

    Send metrics to a custom file format or service. Add custom processing and dispatching.

xk6 makes custom binaries

xk6 is command-line tool and framework written in Go. With xk6, you build custom k6 binaries that bundle one or more extensions written in Go.

With xk6 and the Go toolchain, you can build the k6 binary with the combination of extensions you want. You can use the bundle builder to generate the CLI command that will build your customized k6 binary.

Support for Docker

You now have a new option that doesn't require setting a Go environment! Use Docker to build your custom binary.

Extension use cases

The extensions ecosystem provides endless possibilities to expand the functionality for your k6 testing.

Some reasons you might want to extend k6 include the following:

  • To add support for a new network protocol

    For example, xk6-amqp gives access to resources using the Advanced Message Queueing Protocol (AMQP). With xk6-amqp, your scripts can create message queues and seed messages for tests that include systems like RabbitMQ or ActiveMQ (among others).

  • To incorporate a client library for test dependency

    Everyone wants to run their services in Kubernetes these days. With xk6-kubernetes, your JavaScript tests can interface directly with Kubernetes resources using functionality typically restricted to kubectl. Prepare isolated Namespaces for each test run, or inject environment variables as ConfigMaps.

  • To format and send metrics to the output of your choice

    Suppose your company has consolidated its observability metrics into Prometheus. Use xk6-output-prometheus-remote to publish your k6 test metrics to Prometheus as well!

  • To improve script performance and efficiency

    Perhaps your company uses OpenTelemetry to trace service requests through layers of microservices. Using xk6-distributed-tracing, you can update the http client to link your test requests as the origin for your traces—no need to add JavaScript code to supply the required trace headers.

Next, explore the available extensions to see how you can expand your use of k6 right now.