k6 Load Testing Tool

 

It's an Open Source Solution

k6 is an open source load testing tool built for modern DevOps teams. Use it throughout the software development lifecycle to test the performance of your websites, web apps, APIs and microservices. Stay on top of performance without fuzz.

Developer-centric

With k6, you get a developer-centric load testing tool with flexible and powerful scripting in ES6 JavaScript, modern command line interface, and good automation support. We couldn't find such a tool available on the market, so we built k6.

Open source and community

We believe great developer tools should be open source and come with great documentation, allowing for a community to form around the tool. Visit the Github repo to see the code, roadmap and other information.

Automation native

k6 is built to integrate into your development environment as well as your Continuous Integration (CI) or automation environment. That's why k6 is a command-line tool with features like custom metrics, checks (like asserts) and thresholds.  You have several result output options, including Load Impact Insights for automated results analysis.

Run performance tests from anywhere

Your test scripts work unchanged across single and multi machine (cloud) execution

k6 CLI

Local Execution

Run tests from your local machine to debug a test script or to get quick performance feedback before pushing code to version control and CI.

Self-managed

Run tests from on-premise machines or cloud servers under your own AWS, Azure or GCP account.

Managed, Cloud Execution

For convenience and to scale out, you can move your scripts without changes to run on Load Impact's global cloud infrastructure.

Based on familiar and powerful ES6 JavaScript

Modules

Create ES6 JS modules that can be reused across tests and teams to build a foundational performance testing library for your organization.

Checks and Thresholds

Checks (like asserts) are used to validate functional aspects of your test. Thresholds is the essential feature that you use to specify the pass/fail criteria of your tests. You can create thresholds based on any of the standard metrics collected by k6, as well as any custom metrics that you define.

HTTP/1.1, HTTP/2 and WebSocket

Ready for the present and future k6 supports performance testing systems that talk HTTP/1.1 HTTP/2 and WebSocket.

Batteries included standard library

Besides the standard ES6 JS APIs, k6 comes bundled with APIs to handle Cookies, Crypto, Encodings, Environment variables, HTML forms, HTML parsing, Multipart requests, TLS client certificates, TLS ciphers & versions and more.

script.js

import http from "k6/http";
import { group, sleep, check } from "k6";

// Get login credentials from env vars
let email = __ENV.EMAIL;
let password = __ENV.PASSWORD;

export default function() {
    // Login to get API session token
    let res = http.post("https://api.loadimpact.com/v3/account/login",
        JSON.stringify({ email: email, password: password }),
        { headers: { "Content-Type": "application/json" } }
    );

    sleep(1);

    // Extract API session token from JSON response
    let apiToken = res.json().token.key;

    // Use session token to make API requests
    res = http.get("https://api.loadimpact.com/v3/account/me",
        { headers: { "Authorization": "Token " + apiToken } }
    );
    check(res, {
        "status is 200": (res) => res.status === 200,
        "content-type is application/json": (res) => res.headers['Content-Type'] === "application/json",
        "content OK": (res) => JSON.parse(res.body).hasOwnProperty('organizations')
    });

    sleep(3);
}

Easy, platform native installation flow

 

Debian/Ubuntu

 

  1. Install the latest k6 package:
    $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61
    $ echo "deb https://dl.bintray.com/loadimpact/deb stable main" | sudo tee -a /etc/apt/sources.list
    $ sudo apt-get update
    $ sudo apt-get install k6
  2. Run your first k6 test:
    $ k6 run -u 1 -d 10s github.com/loadimpact/k6/samples/http_get.js

 

Redhat/CentOS

 

  1. Install the latest k6 package:
    $ wget https://bintray.com/loadimpact/rpm/rpm -O bintray-loadimpact-rpm.repo
    $ sudo mv bintray-loadimpact-rpm.repo /etc/yum.repos.d/
    $ sudo yum install k6
  2. Run your first k6 test:
    $ k6 run -u 1 -d 10s github.com/loadimpact/k6/samples/http_get.js
  1. Install k6 using Homebrew:
    $ brew tap loadimpact/k6
    $ brew install k6
  2. Run your first k6 test:
    $ k6 run -u 1 -d 10s github.com/loadimpact/k6/samples/http_get.js
  1. Download the latest k6 MSI installer
  2. Run the installer
  3. Run your first k6 test:
    $ k6 run -u 1 -d 10s github.com/loadimpact/k6/samples/http_get.js

Integrate into your automation pipelines

Whether you run your tests from a machine that you manage or from the Load Impact cloud service you can easily integrate performance tests into your favorite CI tool like CircleCI, GitlabCI, TravisCI, JenkinsCI and TeamCity.