Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
jetbrains avatar

Writing Tests

  • 1 installs
  • 20.4k repo stars
  • Updated August 5, 2026
  • jetbrains/intellij-community

writing-tests skill documents Guidelines for writing tests in IntelliJ codebase.

About

writing-tests skill documents Guidelines for writing tests in IntelliJ codebase. Use when creating new test classes or test methods.. name: writing-tests description: Guidelines for writing tests in IntelliJ codebase. Use when creating new test classes or test methods.

  • Guidelines for writing tests in IntelliJ codebase.
  • Platform-specific setup patterns for writing-tests.
  • Evidence-backed steps from upstream SKILL.md.
  • When-to-use criteria for writing-tests versus alternatives.

Writing Tests by the numbers

  • 1 all-time installs (skills.sh)
  • Ranked #644 of 782 Skill Development skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

writing-tests capabilities & compatibility

Capabilities
writing tests quick start · writing tests when to use guidance · writing tests integration patterns
Use cases
documentation
IDEs
intellij · jetbrains
From the docs

What writing-tests says it does

Guidelines for writing tests in IntelliJ IDEA codebase.
SKILL.md
For examples, see `community/platform/testFramework/junit5/test/showcase/`.
SKILL.md
npx skills add https://github.com/jetbrains/intellij-community --skill writing-tests

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1
repo stars20.4k
Last updatedAugust 5, 2026
Repositoryjetbrains/intellij-community

How do I use writing-tests correctly?

Guidelines for writing tests in IntelliJ codebase. Use when creating new test classes or test methods.

Who is it for?

Teams implementing writing-tests workflows from the catalog.

Skip if: Skip when requirements clearly match a different specialized stack.

When should I use this skill?

User asks about writing-tests, guidelines for writing tests in intellij codebase. use when creating new test classes or t.

What you get

Working writing-tests setup with validated configuration and next steps.

Files

SKILL.mdMarkdownGitHub ↗

Writing Tests

Guidelines for writing tests in IntelliJ IDEA codebase.

For examples, see community/platform/testFramework/junit5/test/showcase/.

Prefer JUnit 5 over JUnit 4

Use JUnit 5 with @TestApplication annotation instead of extending LightJavaCodeInsightFixtureTestCase.

Why JUnit 5:

  • Faster: No class hierarchy overhead, shared fixtures via companion objects
  • Cleaner: Annotations (@TestDisposable, @RegistryKey) instead of manual setup/teardown
  • Flexible: Mix EDT and non-EDT tests in one class, parameterized tests, nested tests
  • Better isolation: Each test gets fresh disposables automatically

Shared Fixtures Pattern

Use companion object fixtures shared between all tests:

@TestApplication
internal class MyTest {
  companion object {
    private val projectFixture = projectFixture()
    private val moduleFixture = projectFixture.moduleFixture("src")
  }

  private val project get() = projectFixture.get()
  private val module get() = moduleFixture.get()
}

Lifecycle Hooks

Use JUnit 5 lifecycle annotations for setup and teardown:

@TestApplication
internal class MyTest {
  companion object {
    @JvmStatic
    @BeforeAll
    fun setUpClass() {
      // Once before all tests in class
    }

    @JvmStatic
    @AfterAll
    fun tearDownClass() {
      // Once after all tests in class
    }
  }

  @BeforeEach
  fun setUp() {
    // Before each test method
  }

  @AfterEach
  fun tearDown() {
    // After each test method
  }
}

Note: Prefer @TestDisposable over manual @AfterEach cleanup for resources.

Test Disposables

Use @TestDisposable annotation to inject test-scoped disposables (created before each test, disposed after):

@TestDisposable
lateinit var disposable: Disposable

// Or as parameter
@Test
fun myTest(@TestDisposable disposable: Disposable) { ... }

Registry Values in Tests

Use @RegistryKey annotation instead of Registry.get().setValue():

@Test
@RegistryKey(key = "my.registry.key", value = "true")
fun testWithRegistryEnabled() { ... }

System Properties in Tests

Use @SystemProperty annotation instead of System.setProperty():

@Test
@SystemProperty(propertyKey = "my.property", propertyValue = "value")
fun testWithSystemProperty() { ... }

Running Tests in EDT

Use @RunInEdt annotation to run test methods in EDT:

@TestApplication
@RunInEdt
class MyEdtTest {
  @Test
  fun testInEdt() { ... }
}

// Or for specific methods only
@TestApplication
@RunInEdt(allMethods = false)
class MyTest {
  @Test
  @RunMethodInEdt
  fun testInEdt() { ... }
}

Key Classes

  • com.intellij.testFramework.junit5.TestApplication - initializes shared application
  • com.intellij.testFramework.junit5.TestDisposable - injects test disposables
  • com.intellij.testFramework.junit5.RegistryKey - sets registry values
  • com.intellij.testFramework.junit5.SystemProperty - sets system properties
  • com.intellij.testFramework.junit5.RunInEdt - runs tests in EDT
  • com.intellij.testFramework.junit5.fixture.projectFixture - creates project fixtures
  • com.intellij.testFramework.junit5.fixture.moduleFixture - creates module fixtures

Showcase Tests

  • JUnit5ProjectFixtureTest.kt - project fixture patterns
  • JUnit5DisposableTest.kt - disposable injection
  • JUnit5SystemPropertyTest.kt - system property usage
  • JUnit5RunInEdtTest.java - EDT execution

Running Tests

To run tests via command line, see TESTING.md.

Quick example:

./tests.cmd -Dintellij.build.test.patterns=*MyTest

Related skills

FAQ

What does writing-tests do?

writing-tests skill documents Guidelines for writing tests in IntelliJ codebase.

When should I use writing-tests?

User asks about writing-tests, guidelines for writing tests in intellij codebase. use when creating new test classes or t.

Is this skill safe to install?

Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.