Problem
An IntelliJ Platform plugin test that uses a fixture, such as myFixture.getElementAtCaret(), fails on one machine and passes on another with the same project. The failure stays after ./gradlew clean and after a rerun with --rerun-tasks.
Example from a Groovy plugin test project built with the IntelliJ Platform Gradle Plugin:
- The test compiles a library JAR once with Groovy 4 and once with Groovy 5, and resolves a call to a method of that JAR.
- With the Groovy 5 JAR, the call does not resolve to a
PsiMethod, and Quick Documentation has no target. With the Groovy 4 JAR, the same call resolves. - The failure occurs on IntelliJ IDEA platform 2025.3.6 and 2026.1.4. The same test passes on 2026.2.
The difference between the two JARs (for example, a missing synthetic method in the Groovy 5 bytecode) looks like the cause, but the failure comes from the test environment.
Cause
The IntelliJ Platform Gradle Plugin keeps the test sandbox of the IDE under test in <project-directory>/.intellijPlatform/sandbox/<plugin-name>/<IDE>-<version>/system-test. This directory is outside build/. ./gradlew clean does not remove it, and --rerun-tasks does not reset it either. State left in the sandbox from earlier runs, such as cached data of a dependency JAR that changed, can change the result of a test.
Resolution
- In the project root directory, run
./gradlew clean. -
Delete the sandbox directory:
rm -rf .intellijPlatform/sandbox
-
Run the test again, for example:
./gradlew --no-configuration-cache -PplatformVersion=2026.1.4 <testTask> --tests <TestClass> --rerun-tasks --console=plain
Additional information
The JVM that runs the test is neither the shell JAVA_HOME nor the project Java toolchain. The IntelliJ Platform Gradle Plugin sets javaLauncher of the test task to the JetBrains Runtime bundled with the platform under test, and a custom Test task that inherits from it uses the same JVM. To see the JVM of a test run, filter the --info output:
./gradlew <testTask> --tests <TestClass> --rerun-tasks --info \
| grep "Starting process 'Gradle Test Executor" | grep -oE "Command: [^ ]+"Related issue: IDEA-391904
Comments
0 comments
Please sign in to leave a comment.