Skip to main content
New to Testkube? Unleash the power of cloud native testing in Kubernetes with Testkube. Get Started >

K6

warning

Features described in this document are being deprecated as part of the transition to Test Workflows - Read More.

Testkube's k6 executor provides a convenient way of running k6 tests.

  • Default command for this executor: k6
  • Default arguments for this executor command: <k6Command> <envVars> <runPath>

Parameters in <> are calculated at test execution:

  • <k6Command> - cloud or run depending on the test type
  • <envVars> - list of environment variables
  • <runPath> - path to the test files

See more at "Redefining the Prebuilt Executor Command and Arguments" on the Creating Test page.

๐ŸŽ“What is k6?
  • k6 is a free, developer-centric, and extensible open-source load testing tool that makes performance testing easy and productive for engineering teams.
What can I do with k6?
  • With k6, you can test the reliability and performance of your systems and catch performance regressions and problems earlier. K6 will help you to build resilient and performant applications that scale.
K6 is developed by Grafana Labs and the Open-Source community.

Check out our blog post to follow tutorial steps to harness the power of k6 load testing in Kubernetes with Testkube's CLI and API.

Example k6 testโ€‹

In this example we will use the following k6 test: https://github.com/kubeshop/testkube/blob/main/test/k6/executor-tests/k6-smoke-test-without-envs.js

import http from "k6/http";

export default function () {
http.get("https://testkube.kubeshop.io/");
}

Test Sourceโ€‹

K6 tests may vary significantly. The test may be just a single file, but may also consist of multiple files (modules, dependencies, or test data files). That's why all of the available Test Sources may be used with K6:

  • Git file
  • Git directory
  • File
  • String

Creating and Running a Testโ€‹

If you prefer to use the Dashboard, just go to Tests, and click Add a new test button. Then you need to fill in the test Name, choose the test Type (k6 script), and then choose Test Source.

Fileโ€‹

If the source is File, the test file is uploaded directly.

K6 test - creation dialog - file

Git Fileโ€‹

If the source is a Git file, you need to fill in repository details - Git repository URI (in this case https://github.com/kubeshop/testkube.git), branch (main), and the path to k6 script in your repository (test/k6/executor-tests/k6-smoke-test-without-envs.js). In this example, the repository is public, but in the case of private ones you would need to additionally fill in Git credentials.

K6 test - creation dialog - git file

Stringโ€‹

If the source is a String, the test script is added directly.

K6 test - creation dialog - string

K6 Test Resultsโ€‹

A k6 test will be successful in Testkube when all checks and thresholds are successful. In the case of an error, the test will have failed status, even if there is no failure in the summary report in the test logs. For details check this k6 issue.