Файли
openidea/java/junit-runner
l0ng-ai b5e89aace0 feat(run): show each invocation of a parameterized test in the Run window (#7099)
The JUnit runner and the Gradle test init script report an invocation of a parameterized, repeated or dynamic test with its display name, and the JVM parser puts it under its method node with its own status, output and stack trace; the method shows the aggregate. Rerunning a failed invocation reruns its method.

Fixes #7046
2026-12-01 03:06:11 +08:00
..

JUnit runner

ai.openidea.junit.Runner runs the JUnit 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.

A test's stdout and stderr are reported with it (testStdOut, testStdErr), line by line as they are written; a class's own output (static initializers, @BeforeAll) with the class, and output outside any test, such as a thread the test started, is printed as is. Each line is printed once: JUnit's own output capture, which also copies everything to the original stream, stays off.

JUnit Platform tests run on the Platform launcher. JUnit 4 and JUnit 3 tests run on JUnit 4's own JUnitCore (Junit4Runner) when the classpath has no JUnit Platform, or one without the Vintage engine, so a JUnit 4 project needs nothing beyond its junit dependency.

OpenIDEA starts it for the gutter's JUnit 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 (none for JUnit 4 alone), 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 5 and JUnit 4 with:

python3 build.py --test
python3 build.py