Affected Tests Docs

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.

Decision tree. An empty diff, a docs-only change or a change in out-of-scope modules skips the tests. A file the plugin cannot map to a class, or a changed Spring configuration class, runs the whole suite. Otherwise the plugin finds the tests the change can affect and runs only those. If a file could not be read or no tests were found, local mode runs the tests found or skips, and CI mode runs everything.
What the plugin does with your change, using the default settings

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

SituationFires when
EMPTY_DIFFgit diff produced no files.
ALL_FILES_IGNOREDEvery changed file matched ignorePaths, for example a docs-only change.
ALL_FILES_OUT_OF_SCOPEEvery changed file sits under outOfScopeTestDirs or outOfScopeSourceDirs, for example a change that only touches a Cucumber module.
UNMAPPED_FILEThe 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_CHANGEDA 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_INCOMPLETEAt 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_EMPTYMapping succeeded but the strategies found no tests.
DISCOVERY_SUCCESSMapping 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

ActionMeaning
SELECTEDRun only the discovered affected tests.
FULL_SUITERun the whole suite, with no --tests filter.
SKIPPEDExit 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:

ModeEMPTY_DIFFALL_FILES_IGNOREDALL_FILES_OUT_OF_SCOPEUNMAPPED_FILESPRING_CONFIG_CHANGEDDISCOVERY_INCOMPLETEDISCOVERY_EMPTY
localSKIPPEDSKIPPEDSKIPPEDFULL_SUITEFULL_SUITESELECTEDSKIPPED
ciSKIPPEDSKIPPEDSKIPPEDFULL_SUITEFULL_SUITEFULL_SUITEFULL_SUITE
strictFULL_SUITEFULL_SUITESKIPPEDFULL_SUITEFULL_SUITEFULL_SUITEFULL_SUITE
autoResolves 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 contentsSituationDefault actionOverride
Only mapped production or test .java filesDISCOVERY_SUCCESS (or DISCOVERY_EMPTY if no tests map)SELECTEDDiscovery tuning
Only files matching ignorePathsALL_FILES_IGNOREDSKIPPEDonAllFilesIgnored or mode = "strict"
Only files under outOfScopeTestDirs or outOfScopeSourceDirsALL_FILES_OUT_OF_SCOPESKIPPEDonAllFilesOutOfScope
Any YAML, Gradle or Liquibase file, or a .java file outside the configured directoriesUNMAPPED_FILEFULL_SUITEonUnmappedFile = "selected"
No changed filesEMPTY_DIFFSKIPPEDonEmptyDiff = "full_suite" or mode = "strict"
Mapping succeeds but no tests are foundDISCOVERY_EMPTYSKIPPED, or FULL_SUITE in ci and strictonDiscoveryEmpty or mode
A scanned file failed to parseDISCOVERY_INCOMPLETESELECTED, or FULL_SUITE in ci and strictonDiscoveryIncomplete or mode
A changed class is annotated @SpringBootApplication, @Configuration, @SpringBootConfiguration or @ConfigurationPropertiesSPRING_CONFIG_CHANGED for a full suite, otherwise DISCOVERY_SUCCESS with integration tests addedFULL_SUITEonApplicationClassChanged and onConfigurationClassChanged
Java plus an unmapped fileUNMAPPED_FILE, which takes precedenceFULL_SUITEonUnmappedFile = "selected" to fall through to discovery
The base ref cannot be resolved, or the directory is not a git work treeTask failsHard errorNone

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.