Skip to content
| Marketplace
Sign in
Visual Studio Code>Testing>Kotlin Test ExplorerNew to Visual Studio Code? Get it now.
Kotlin Test Explorer

Kotlin Test Explorer

r0kuko

|
2 installs
| (0) | Free
Run and debug Kotlin (JUnit 5) tests in VS Code via Gradle. Compatible with the Test Explorer UI.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Kotlin Test Adapter for VS Code

Kotlin Test Adapter

VS Code Kotlin JUnit 5 Gradle License CI

A Visual Studio Code extension that discovers, runs and reports Kotlin unit tests authored with JUnit 5 in Gradle projects (single- or multi-module).

It uses VS Code's native Testing API, so tests show up in the built-in Test Explorer view automatically. To use the legacy hbenl.vscode-test-explorer UI, install the ms-vscode.test-adapter-converter extension which adapts the native API to the Test Adapter protocol.

Status

This is an MVP focused on:

  • ✅ Kotlin + JUnit 5 test discovery (regex-based, no LSP required)
  • ✅ Gradle multi-module support (auto-discovers subprojects)
  • ✅ Run via Gradle (./gradlew :module:test --tests ...)
  • ✅ JUnit XML result parsing (pass / fail / skipped, durations, messages)
  • ✅ Refresh on file save / via command
  • ⏳ Debug support (currently falls back to Run; planned)
  • ⏳ Kotest / Spek (planned)
  • ⏳ kotlin-lsp powered semantic discovery (planned)

How discovery works

  1. The extension scans each workspace folder for Gradle build scripts (build.gradle, build.gradle.kts, settings.gradle*).
  2. Every directory containing a build script becomes a module in the test tree.
  3. For each module, files matching kotlinTestAdapter.testSourceGlobs are scanned with a lightweight Kotlin tokenizer that recognises:
    • the package declaration,
    • top-level class / object declarations,
    • functions annotated with @Test, @ParameterizedTest, @RepeatedTest or @TestFactory.
  4. Results are grouped by class and surfaced in the Test Explorer.

Running tests

When you click ▶ on an item, the extension invokes Gradle in the workspace folder for the corresponding module:

./gradlew :module:test --tests "fq.ClassName.methodName" --rerun-tasks --continue

Reports are read from build/test-results/<task>/*.xml and applied back to each TestItem.

Configuration

Setting Default Description
kotlinTestAdapter.gradleCommand (auto) Override the Gradle command. Falls back to ./gradlew (or gradlew.bat) if a wrapper exists, otherwise gradle.
kotlinTestAdapter.gradleExtraArgs [] Extra arguments appended to every Gradle invocation.
kotlinTestAdapter.testSourceGlobs src/test/kotlin/**/*.kt, … Globs (relative to each module) used to find test files.
kotlinTestAdapter.excludeGlobs **/build/**, **/.gradle/**, **/node_modules/** Globs excluded from discovery.

Sample project

The repository ships with a multi-module Gradle Kotlin sample under sample/ that you can use to try the extension:

sample/
├── settings.gradle.kts        # includes :core and :app
├── build.gradle.kts
├── core/
│   ├── build.gradle.kts
│   └── src/{main,test}/kotlin/sample/core/
└── app/
    ├── build.gradle.kts
    └── src/test/kotlin/sample/app/

Press F5 in this repository to launch a new Extension Development Host already opened on the sample/ folder.

Building the extension

bun install
bun run compile

Then either press F5 or package with vsce package.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft