Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grafana/k6-intellij-plugin
Brings k6 to your favorite IDE!
https://github.com/grafana/k6-intellij-plugin
intellij intellij-plugin k6 load-testing performance-testing
Last synced: 3 months ago
JSON representation
Brings k6 to your favorite IDE!
- Host: GitHub
- URL: https://github.com/grafana/k6-intellij-plugin
- Owner: grafana
- License: apache-2.0
- Archived: true
- Created: 2021-02-09T10:17:37.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-02-04T10:07:59.000Z (almost 3 years ago)
- Last Synced: 2024-09-24T10:03:22.546Z (3 months ago)
- Topics: intellij, intellij-plugin, k6, load-testing, performance-testing
- Language: Kotlin
- Homepage: https://plugins.jetbrains.com/plugin/16141-k6
- Size: 749 KB
- Stars: 4
- Watchers: 136
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
> ### ⚠ ️ This project is no longer maintained in this repository.
>
> Development and maintenance have been stopped in this repository.
>
> A fork of this project is active and maintained at [mbolotov/k6-intellij-plugin](https://github.com/mbolotov/k6-intellij-plugin).IntelliJ-based Plugin to run [k6 tests](https://k6.io/) locally or in the [k6 Cloud](https://k6.io/cloud) from your IntelliJ IDE.
- Run a k6 test as a Run configuration (a common way to run something withing IntelliJ platform)
- Run a k6 test using keyboard shortcuts.
- Run a k6 test from the search Menu.
- Run a k6 test from the popup file menu.
- Visualize the k6 results in the Run tool window.## How it works
This plugin allows running a k6 test in the 4 different ways:
### Run the test as a Run configuration.
A k6 run configuration can be created in several ways:
* By clicking on a green run gutter near the `default function` in the editor: ![img.png](doc/gutter.png)
* Via the context menu of a k6 test file
* Using the `Run/Debug Configurations` dialog windowOnce a run configuration is created, it can be used multiple times to execute the test.
Beside the test path itself, a run configuration can define some other properties to be used to execute the test:
* `Local`/`Cloud` run type selection
* Additional CLI parameters, like `--vus 10`
* Additional environmental variables
* Define whether to show each threshold as a separate test in the test console by selecting the `Show thresholds as tests` checkboxDefault values for each of the properties can be defined via a `Run configuration template`.
### Run the test from the popup file menu.
Select the test file, open the file options and click on `k6: run current file` or `k6: run current file in k6 cloud`.
![k6 Cloud File Options](doc/intellij-k6-plugin-file-option.png)
### Run the test from the Search Menu.
From the main menu, select Navigate | Search Everywhere or press `Shift` twice to open the search window. Search for `k6` and trigger `k6: run current file` or `k6: run current file in k6 cloud`.
![k6 Search Commands](doc/intellij-k6-plugin-search-commands.png)
### Run the test using keyboard shortcuts.
By default, `Alt+K` for running local tests, and `Alt+Shift+K` for cloud tests.
![k6 Shortcuts](doc/intellij-k6-plugin-shortcuts.png)
When IntelliJ IDEA runs a k6 test, the [Run tool window](https://www.jetbrains.com/help/idea/run-tool-window.html) will display the test results generated by k6.
![k6 Output](doc/intellij-k6-plugin-run-output.png)
For running cloud tests, set your [k6 Cloud Token](https://app.k6.io/account/token) in `Settings/Preferences/Tools/k6`.
![k6 Cloud Token](doc/intellij-k6-plugin-cloud-token.png)
## Run a test written in TypeScript
k6 does not support running a typescript test directly. To execute both build task and run test actions **in one click** you can define a `Run configuration`
to run your *compiled js test* and to execute a npm build script before launch:![img.png](doc/typescript-before.png)
## Show thresholds as tests
When `Show thresholds as tests` checkbox is selected in a run configuration, the plugin will display each configured threshold as a passed or failed test inside the test console tree view:![thresholds as tests](doc/thresholds-as-tests.gif)
Each of the threshold entry is clickable and navigates to the threshold source element by double click (or key shortcut).
Under the hood, the plugin utilises `handleSummary` callback to collect the test execution results, so it has to wrap original script and proxy the calls.## Installation
- In the Settings/Preferences dialog, select Plugins.
- Use the Marketplace tab to find the k6 plugin.
- Click install.
- Enjoy!### Build plugin from the sources
```bash
./gradlew buildPlugin
````
Install plugin from local file system via the following menu item:
![img.png](doc/install-plugin.png)### Start IDE bundled with plugin via gradle:
```bash
./gradlew runIde
```