Getting Started with k6 tests in Load Impact

Streaming your k6 results to Load Impact Insights gives you the convenience and benefits of test result storage, analysis and trending in the cloud.

Load Impact API token

First, you need to get your Load Impact API token from your account pages in-app
. Copy it and set the environment variable K6_CLOUD_TOKEN.

Alternatively, once you have k6 installed (see below), you can login to your Load Impact account from k6 using:
k6 login cloud
This will set retrieve and store your Load Impact API token locally in a config file.

Install k6

You can install k6 with a simple command using docker: 
docker pull loadimpact/k6
Don't have docker? Check out the alternative ways to install k6.

Run first test

Let's create a simple load test called script.js.
import http from "k6/http";
import { sleep } from "k6";

// Test run configuration
export let options = {
  // ramp up from 0 to 10 VUs during 60 seconds
  stages: [
    { duration: "60s", target: 10 }

  // set loadimpact k6 test name
  ext: {
    loadimpact: {
      name: 'My-First-Test'

// Test run scenario
export default function() {
To run the test streaming the results to the Load Impact Insights - run the following command using docker:

docker run -i -e K6CLOUD_TOKEN=<insert_your_api_token> \ loadimpact/k6 run -o cloud - <script.js

You can read about more options about to run your k6 tests.

Note: If your running Docker on Windows the command is slightly different, see Running k6 in Docker on Windows

When executed the command line output will contain a URL link to your results in Load Impact.

Copy the URL and open it in your browser to follow along your k6 results in real time.

See next: k6 Insights overview

Feedback and Knowledge Base