Mock

This is documentation for the next version of K6. For the latest stable release, go to the latest version.

Open source

Mock

You can use this secret source to test your tests quick and easy.

bash
$ k6 run --secret-source=cli=mysecret=value script.js
docker

You can even use multiple ones and have some of them named or set as default.

bash
JavaScript
import secrets from "k6/secrets";

export default async () => {
  const my_secret = await secrets.get("cool");
  console.log(my_secret == "cool secret");
  const anothersource = await secrets.source("another")
  console.log(await anothersource.get("cool") == "cool secret");
  console.log(await anothersource.get("cool") == "not cool secret");
}