> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# k6io/test

Run load tests and reliability tests using k6. This orb allows for running tests both locally on the runner and in the k6 cloud SaaS service.


## Jobs

### test

Run a k6 test


| Parameter | Type | Default | Description |
|---|---|---|---|
| `arguments` | string |  | Any command-line arguments, or flags, that you would like to pass on to k6. For a full list of options, see https://k6.io/docs/using-k6/options.
 |
| `cloud` | boolean | false | To run in the k6 cloud, provide your k6 cloud token as a secret to the input `token`. Dont have a k6 account yet? Go to https://k6.io/cloud and activate your free trial.
 |
| `script` | string | test.js | The path to your test script, relative to the current working directory
 |
| `tag` | string | latest | Allows for overriding the tag used to pick a docker image for the k6 test job. |
| `token` | string | K6_CLOUD_TOKEN | The name of the environment variable containing the token used for accessing the k6 cloud. You can find yours at https://app.k6.io/account/api-token.
 |

## Examples

### test_cloud

Executes a k6 load test or reliability test in the k6 cloud. Dont have a k6 cloud account yet?
Go to https://k6.io/cloud and activate your free trial.


```yaml
version: '2.1'
orbs:
  k6io: k6io/test@1.1.0
workflows:
  load_test:
    jobs:
      - k6io/test:
          cloud: true
          script: tests/cloud-test.js
          token: MY_SECRET_TOKEN_ENVVAR
```

### test_local

Executes a k6 load test or reliability test on the currently used runner.


```yaml
version: '2.1'
orbs:
  k6io: k6io/test@1.1.0
workflows:
  load_test:
    jobs:
      - k6io/test:
          script: tests/api-stressing.js
```

### test_with_args

Executes a test with arguments supplied to the k6 CLI. Any argument with either a CLI flag or an
environment variable can be used here. For a full list of options, see https://k6.io/docs/using-k6/options


```yaml
version: '2.1'
orbs:
  k6io: k6io/test@1.1.0
workflows:
  load_test:
    jobs:
      - k6io/test:
          arguments: '--env SOME_ENV_VAR=some-value --compatibility-mode=base'
          script: tests/some-test.js
```