Instrucciones de origen · Vista previa de solo lectura
Más de este repositorio
name
testing
description
Run or troubleshoot IntelliJ `tests.cmd` tests and discovery.
Testing Guide for IntelliJ IDEA
Quick Start
./tests.cmd --module <module> --test <pattern>
--module — the JPS module containing the test classes (always use the test's own module). To find the module name, look at the .iml file in the test's directory — the module name is the .iml filename without the extension.
--test — FQN, wildcard pattern, or FQN#methodName
# Single test class (FQN)
./tests.cmd --module intellij.cidr.compiler.custom.tests \
--test com.intellij.cidr.compiler.custom.CidrCustomCompilerReadTest
# Wildcard pattern
./tests.cmd --module intellij.goland.tests \
--test com.goide.comments.*Test
# Specific test method (wildcards cannot be used with #)
./tests.cmd --module intellij.cidr.compiler.custom.tests \
--test com.intellij.cidr.compiler.custom.CidrCustomCompilerReadTest#testSingleDefine
# Multiple (semicolon-separated)
./tests.cmd --module intellij.platform.build.tests \
--test org.jetbrains.intellij.build.TestSelectorsTest#class selector;org.jetbrains.intellij.build.FileSetTest
Simple class names like MyTest do NOT work — always use FQN or wildcard (*MyTest).
Why simple names fail
Patterns are transformed (* → .*, . → ) and matched against the fully qualified class name using (full-string match):
\.
Pattern.matches()
Pattern
Regex
Matches org.example.MyTest?
MyTest
MyTest
NO — doesn't cover the package prefix
*MyTest
.*MyTest
YES
org.example.MyTest
org\.example\.MyTest
YES
org.example.*
org\.example\..*
YES
Community tests
Use community/tests.cmd for tests that belong to community-only modules:
Omit --test_arg to check all modules. Do not use bazel run for this target: it streams noisy test output and does not provide Bazel's test summary.
On failure, keep agent context small by extracting the failing dynamic-test names and messages from Bazel's JUnit report instead of printing the full test.log:
xmllint --xpath '//testcase[failure or error]/@name | //testcase[failure or error]/*[self::failure or self::error]/@message' \
out/bazel-testlogs/tests/ideaProjectStructure/projectStructureTests_test/test.xml
Product layout and packaging changes
When changing ProductProperties, productImplementationModules, product content descriptors, plugin/module-set packaging, or generated product layout XML, also run:
Usage: tests.cmd --module <module> --test <pattern> [options]
Required:
--module <module> Name of the JPS module which contains the test classes
--test <pattern> Full test class name (FQN) or wild card pattern (e.g. com.intellij.*Test) or exact FQN#methodName
Options:
--debug Debug build scripts JVM process
--help Show this help message
Additional options are passed as JVM flags to org.jetbrains.intellij.build.TestingOptions
Example: -Dintellij.build.test.debug.enabled=true -Dintellij.build.test.debug.suspend=true -Dintellij.build.test.debug.port=5005
Additional JVM options
Extra -D... arguments are passed through as JVM flags to org.jetbrains.intellij.build.TestingOptions:
The pass. prefix is stripped, so -Dpass.my.flag=true becomes -Dmy.flag=true in the test JVM
Debugging:-Dintellij.build.test.debug.enabled=true -Dintellij.build.test.debug.port=5005 -Dintellij.build.test.debug.suspend=true — attach IDE debugger to port 5005.
Verify --test uses FQN or wildcard, not simple class name: --test com.example.MyTest
Check that --module is the module that actually contains the test class (look at the .iml file location)
Check that class name ends with Test (or use -Dpass.idea.include.unconventionally.named.tests=true)
Before troubleshooting further, check whether the test lives in a separate Bazel module such as community/platform/build-scripts/bazel; those tests must be run with module-local ../../../../bazel.cmd test, not tests.cmd
Tests pass locally but fail in CI:
Check test isolation - tests may depend on execution order
Verify environment variables and system properties
Use -Dintellij.build.test.attempt.count=3 for flaky tests