Skip to content

kotest/kotest-intellij-plugin

Repository files navigation

kotest-intellij-plugin

build-master intellij-badge Downloads Rating

The official Kotest plugin for Intellij and Android Studio

Getting Started

This plugin requires Kotest 4.1.0 or above.

  val kotestVersion = "4.1.3" or "4.2.6"
  
  // and then the kotlin dependencies
  dependencies {
    ...
    testImplementation("io.kotest:kotest-assertions-core-jvm:$kotestVersion") // optional, for kotest assertions
    testImplementation("io.kotest:kotest-runner-junit5-jvm:$kotestVersion") // required
  }
  
  tasks.withType<Test> { useJUnitPlatform() }

This plugin has been tested with IDEA 2020.3, 2020.2, 2020.1 and 2019.3.1.

Gutter Icons

The plugin provides gutter run icons for specs, top level tests, and nested tests.

gutter_icon_picture

Any tests disabled via a bang or by xfunctions such as xdescribe, will have a disabled test icon in the gutter.

gutter_icon_picture

Running Tests

If you execute a spec from the gutter icon, then all tests in that spec will be executed. If you execute a test, then that test and all nested tests will be executed.

gutter_icon_picture

Tool Window

The plugin provides a tool window view which displays the structure of your tests. The window describes the currently selected test file, which includes any specs defined in that file and tests contained inside those specs. The tree layout will mirror the structure of your tests for easy navigation.

test_explorer_tests

The tool window will include lifecycle callback methods (such as before / after test) if defined, as well as included test factories.

test_explorer_callbacks_picture

Clicking on a spec, test, include or callback will navigate directly to that element in the source editor.

Any tests that have been disabled using the bang prefix will have a different icon.

test_window_disabled_tests

You can execute (run/debug/run with coverage) a test or spec directly from this window. In addition, the window shows all test modules and allows you to run all tests in that module.

gutter_icon_picture

Modules, callbacks, and includes can be filtered out if you don't wish to see them. They are included by default.

Duplicated Test Highlighting

You cannot have two tests with the same name. The plugin will highlight any duplicated test names as errors.

duplicated_test_picture

Context Menu Run / Debug

Right clicking on a package will allow you to run, debug or run with coverage all the tests inside that package.

run_context_menu_picture

Intentions

This plugin has some basic intentions. For example, you can quickly mark a test as disabled.

gutter_icon_picture

Or you can highlight some text and mark it as should throw, or surround with a soft assertion block.

gutter_icon_picture