Decision model
Every run resolves to exactly one situation (what the engine saw) and exactly one action (what it will do). Both appear in the summary log line, so you can tell at a glance why the plugin chose what it did.
Read the tree below from the top. The first question that answers yes decides the run. The grey tag on each outcome is the situation name you will see in the log.
The summary log line
Each affectedTest run prints one line in the form Affected Tests: <OUTCOME> (<SITUATION>) — <details>:
Affected Tests: SELECTED (DISCOVERY_SUCCESS) — 3 changed file(s), 2 production class(es), 5 test class(es) affected
Affected Tests: FULL_SUITE (UNMAPPED_FILE) — 1 changed file(s); running full suite (onUnmappedFile=FULL_SUITE — non-Java or unmapped file in diff).
Affected Tests: SKIPPED (ALL_FILES_IGNORED) — 1 changed file(s); every changed file matched ignorePaths.
The outcome and situation are present on every branch, so a CI dashboard can match ^Affected Tests: (SELECTED|FULL_SUITE|SKIPPED) and group runs without parsing the rest.
On a SELECTED outcome the task also prints the first five class names per module, so a reviewer can sanity-check the dispatch from the default CI log. --info prints the full list. The cap stops a utility change that ripples into hundreds of tests from overflowing the 4 MiB GitHub Actions per-step log limit.
Running 17 affected test classes across 2 module(s):
application:test (12 test classes)
com.example.auth.LoginControllerTest
com.example.auth.TokenServiceTest
… and 10 more (use --info for full list)
api:test (5 test classes)
com.example.api.PublicEndpointsTest
Situations
| Situation | Fires when |
|---|---|
EMPTY_DIFF | git diff produced no files. |
ALL_FILES_IGNORED | Every changed file matched ignorePaths, for example a docs-only change. |
ALL_FILES_OUT_OF_SCOPE | Every changed file sits under outOfScopeTestDirs or outOfScopeSourceDirs, for example a change that only touches a Cucumber module. |
UNMAPPED_FILE | The diff holds at least one file the plugin cannot resolve to a Java class under sourceDirs or testDirs, such as application.yml, build.gradle or a Liquibase changelog. |
SPRING_CONFIG_CHANGED | A changed class carries a Spring application or configuration annotation, and the matching onXxxClassChanged setting resolved to a full suite. See Spring and @Bean changes. |
DISCOVERY_INCOMPLETE | At least one scanned file failed to parse (malformed source, a half-committed refactor, an encoding problem). It takes precedence over DISCOVERY_EMPTY and DISCOVERY_SUCCESS, because the selection is known to be under-reported. |
DISCOVERY_EMPTY | Mapping succeeded but the strategies found no tests. |
DISCOVERY_SUCCESS | Mapping and discovery produced a non-empty set. |
If the base ref cannot be resolved, or the directory is not a git work tree, the task fails with an error instead of picking a situation. That prevents a broken checkout from silently skipping tests.
Actions
| Action | Meaning |
|---|---|
SELECTED | Run only the discovered affected tests. |
FULL_SUITE | Run the whole suite, with no --tests filter. |
SKIPPED | Exit 0 without running tests. |
Each situation has its own action. The action is resolved in strict priority order: an explicit onXxx setting first, then the mode default. Because zero-config installs always resolve to a concrete mode through auto, nothing you leave unconfigured changes behaviour silently.
Mode profiles
mode seeds the action for every situation you have not configured:
| Mode | EMPTY_DIFF | ALL_FILES_IGNORED | ALL_FILES_OUT_OF_SCOPE | UNMAPPED_FILE | SPRING_CONFIG_CHANGED | DISCOVERY_INCOMPLETE | DISCOVERY_EMPTY |
|---|---|---|---|---|---|---|---|
local | SKIPPED | SKIPPED | SKIPPED | FULL_SUITE | FULL_SUITE | SELECTED | SKIPPED |
ci | SKIPPED | SKIPPED | SKIPPED | FULL_SUITE | FULL_SUITE | FULL_SUITE | FULL_SUITE |
strict | FULL_SUITE | FULL_SUITE | SKIPPED | FULL_SUITE | FULL_SUITE | FULL_SUITE | FULL_SUITE |
auto | Resolves to ci when CI, GITLAB_CI, GITHUB_ACTIONS, JENKINS_HOME, CIRCLECI, TRAVIS, BUILDKITE or TF_BUILD is set, otherwise to local. |
DISCOVERY_SUCCESS is always SELECTED unless you override it.
Leaving mode unset picks auto. The UNMAPPED_FILE to FULL_SUITE safety net is the default in every built-in mode, so a zero-config install still escalates on unmapped files. The SPRING_CONFIG_CHANGED default is the same in every mode too, and the Spring settings can narrow it.
What each diff does with the defaults
| Diff contents | Situation | Default action | Override |
|---|---|---|---|
Only mapped production or test .java files | DISCOVERY_SUCCESS (or DISCOVERY_EMPTY if no tests map) | SELECTED | Discovery tuning |
Only files matching ignorePaths | ALL_FILES_IGNORED | SKIPPED | onAllFilesIgnored or mode = "strict" |
Only files under outOfScopeTestDirs or outOfScopeSourceDirs | ALL_FILES_OUT_OF_SCOPE | SKIPPED | onAllFilesOutOfScope |
Any YAML, Gradle or Liquibase file, or a .java file outside the configured directories | UNMAPPED_FILE | FULL_SUITE | onUnmappedFile = "selected" |
| No changed files | EMPTY_DIFF | SKIPPED | onEmptyDiff = "full_suite" or mode = "strict" |
| Mapping succeeds but no tests are found | DISCOVERY_EMPTY | SKIPPED, or FULL_SUITE in ci and strict | onDiscoveryEmpty or mode |
| A scanned file failed to parse | DISCOVERY_INCOMPLETE | SELECTED, or FULL_SUITE in ci and strict | onDiscoveryIncomplete or mode |
A changed class is annotated @SpringBootApplication, @Configuration, @SpringBootConfiguration or @ConfigurationProperties | SPRING_CONFIG_CHANGED for a full suite, otherwise DISCOVERY_SUCCESS with integration tests added | FULL_SUITE | onApplicationClassChanged and onConfigurationClassChanged |
| Java plus an unmapped file | UNMAPPED_FILE, which takes precedence | FULL_SUITE | onUnmappedFile = "selected" to fall through to discovery |
| The base ref cannot be resolved, or the directory is not a git work tree | Task fails | Hard error | None |
The onUnmappedFile = "full_suite" default follows one rule: run more, never less. A change to application.yml can alter production behaviour as surely as a .java change, so the plugin cannot safely pick a subset from an empty Java mapping.