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

# grafana/k6

Run load tests and reliability tests using k6. This orb allows for running k6 tests locally on the runner and in the k6 Cloud.


## Jobs

### k6

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 | Whether it runs the k6 test in the k6 Cloud. If true, set your K6_CLOUD_TOKEN on the CircleCI environment variables.
 |
| `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. |

## Examples

### test_cloud

Executes a k6 test in the k6 Cloud.
Ensure you set your K6_CLOUD_TOKEN on the CircleCI environment variables.


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

### test_local

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


```yaml
version: '2.1'
orbs:
  grafana: grafana/k6@1.1.0
workflows:
  load_test:
    jobs:
      - grafana/k6:
          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:
  grafana: grafana/k6@1.1.0
workflows:
  load_test:
    jobs:
      - grafana/k6:
          arguments: '--env SOME_ENV_VAR=some-value --compatibility-mode=base'
          script: tests/some-test.js
```