Forrest logo
tool overview
On this page you find all important commands for the CLI tool k6. If the command you are looking for is missing please ask our AI.

k6

k6 is a command line tool designed to perform load testing and stress testing on web applications. It is developed in JavaScript and Go, and it supports scripting in JavaScript ES6 syntax.

With k6, you can simulate virtual users and generate realistic loads on your application to evaluate its performance and scalability. It is built for simplicity and ease of use, allowing developers to quickly write and execute performance tests without complex configurations.

k6 provides various features to assist load testing, such as the ability to customize virtual user behaviors, set up test scenarios, control network conditions, and measure performance metrics like response time and throughput. It also offers extensive reporting capabilities, including generating individual test reports and integrating with third-party systems for further analysis.

It has a user-friendly and intuitive command line interface (CLI), which supports running tests in different execution modes, such as a simple single test run or continuous and distributed testing. It can also be integrated with other tools and frameworks through APIs and command line flags.

k6 offers a set of powerful metrics and assertions that allow you to define pass/fail criteria for your load tests, ensuring that your application meets the desired performance standards. It supports easy integration with Continuous Integration (CI) systems, allowing you to incorporate load testing into your development workflow.

k6 is an open-source tool released under the Apache 2.0 license, which means it is free to use, modify, and distribute. It has a thriving community of contributors and users who actively contribute to its development and provide support through documentation, forums, and chat channels.

Overall, k6 is a reliable and versatile command line tool that simplifies load testing, making it an essential part of the performance testing toolkit for developers and organizations.

List of commands for k6:

  • k6:tldr:2491d k6: Run load test locally with a given environment variable.
    $ k6 run -e ${HOSTNAME=example-com} ${script-js}
    try on your machine
    explain this command
  • k6:tldr:252e9 k6: Run load test on cloud infrastructure.
    $ k6 cloud ${script-js}
    try on your machine
    explain this command
  • k6:tldr:2ddfb k6: Run load test locally using InfluxDB to store results.
    $ k6 run --out influxdb=${http:--localhost:8086-k6db} ${script-js}
    try on your machine
    explain this command
  • k6:tldr:52275 k6: Log in to cloud service using secret token.
    $ k6 login cloud --token ${secret}
    try on your machine
    explain this command
  • k6:tldr:7f3f3 k6: Run load test locally.
    $ k6 run ${script-js}
    try on your machine
    explain this command
  • k6:tldr:89d4b k6: Run load test locally with a given number of virtual users and duration.
    $ k6 run --vus ${10} --duration ${30s} ${script-js}
    try on your machine
    explain this command
  • k6:tldr:8e2bd k6: Run load test locally and discard response bodies (significantly faster).
    $ k6 run --discard-response-bodies ${script-js}
    try on your machine
    explain this command
  • k6:tldr:f064c k6: Run load test locally using the base JavaScript compatibility mode (significantly faster).
    $ k6 run --compatibility-mode=base ${script-js}
    try on your machine
    explain this command
tool overview