Getting Started with k6 tests in Load Impact


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 a simple test

Let's create a simple load test called script.js.
import http from "k6/http";
export default function() {
To run the test and print the results in the console - run the following command using docker:
docker run -i loadimpact/k6 run \
    --vus 10 --duration 30s \
    - <script.js
You can read about more options about to run your k6 tests.

Stream results to Load Impact Insights

Streaming your k6 results to Load Impact Insights gives you the benefits of:
First, you need to get your Load Impact token from the Profile settings page in the app, in the Insider program panel. Then add '-e "K6CLOUD_TOKEN=your-token"' together with '-o cloud' to the command to enable cloud output from k6.
docker run -i loadimpact/k6 run \
    --vus 10 --duration 30s \
    -o cloud \
    -e K6CLOUD_TOKEN=<your token> \
    - <script.js
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.

Load Impact options

By default, the name of a k6 test is the test file name, but you could specify the name when configuring the options property `` as: 
export const options = {
  ext: {
    loadimpact: {
      name: 'your-test-name'
}; export default function() {
... }

See next: k6 Insights overview

Feedback and Knowledge Base