Файли
openidea/java/junit-runner
LU XIANGRUIтаwildcatDownstairs 8c23c589ca feat(run): run JUnit 5 tests of Maven modules without Maven (#5571)
Gutter Run / Debug of JUnit 5 tests in Maven modules now starts OpenIDEA's own JUnit Platform runner (java/junit-runner, built from the in-tree source and embedded by ide-sdk) on the language server's test classpath instead of mvn test, as IDEA runs Maven tests unless build/run actions are delegated to Maven. The runner reports TeamCity service messages to the existing test tree; Debug and Rerun Failed Tests reuse it. The launcher jar of the engine's version comes from the classpath, else from the engine's Maven/Gradle repository folder, else is downloaded once from Maven Central.

The runner JVM gets the module's Surefire configuration like IDEA's MavenJUnitPatcher: argLine (with @{...} late replacement), systemPropertyVariables / systemProperties, environmentVariables, workingDirectory, additionalClasspathElements and classpathDependencyExcludes, read from the cached effective POM (else the module POM); the console lists what was applied.

Settings › Build Tools › Maven › Run tests using: OpenIDEA (default) or Maven (the previous mvn test -Dtest=... path). JUnit 4-only, TestNG and Gradle tests keep their current runners.

Closes #5553

Co-authored-by: wildcatDownstairs <[email protected]>
2026-11-25 13:15:08 +08:00
..

JUnit Platform runner

ai.openidea.junit.Runner runs the JUnit Platform tests named by its arguments (com.acme.OrderTest, com.acme.OrderTest#method; a method selects every overload, so parameterized tests run too) and prints each test as the TeamCity service messages of src/features/run/gradleTests.gradle, which the Run window's JVM parser already reads. It exits with 1 when a test failed or none ran.

OpenIDEA starts it for the gutter's JUnit 5 tests of Maven modules (Settings › Maven › Run tests using: OpenIDEA) as java -ea -cp <test classpath>:<runner>:<launcher> ai.openidea.junit.Runner …. ide_sdk::java::junit_launcher picks junit-platform-launcher of the engine's version, and ide_build::surefire reads the module's Surefire configuration for the JVM (IDEA's MavenJUnitPatcher).

The jar is committed and embedded by ide-sdk (junit_runner_jar). Rebuild it after changing the source, and check it against JUnit with:

python3 build.py --test
python3 build.py