Package io.affectedtests.gradle
Class AffectedTestsExtension
java.lang.Object
io.affectedtests.gradle.AffectedTestsExtension
DSL extension for configuring the Affected Tests plugin.
Usage in build.gradle:
affectedTests {
baseRef = "origin/master"
includeUncommitted = true
runAllIfNoMatches = false
strategies = ["naming", "usage", "impl", "transitive"]
transitiveDepth = 2
testSuffixes = ["Test", "IT", "ITTest", "IntegrationTest"]
sourceDirs = ["src/main/java"]
testDirs = ["src/test/java"]
excludePaths = ["**/generated/**"]
includeImplementationTests = true
implementationNaming = ["Impl"]
}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.gradle.api.provider.Property<String> Git base ref to diff against.abstract org.gradle.api.provider.ListProperty<String> Glob patterns for files to exclude from analysis.abstract org.gradle.api.provider.ListProperty<String> Implementation naming suffixes (e.g.abstract org.gradle.api.provider.Property<Boolean> Include tests for implementations of changed interfaces/base classes.abstract org.gradle.api.provider.Property<Boolean> Include staged changes.abstract org.gradle.api.provider.Property<Boolean> Include uncommitted (unstaged) changes.abstract org.gradle.api.provider.Property<Boolean> Run full test suite if no affected tests are found.abstract org.gradle.api.provider.ListProperty<String> Production source directories (relative to each module root).abstract org.gradle.api.provider.ListProperty<String> Strategies to use for test discovery.abstract org.gradle.api.provider.ListProperty<String> Test source directories (relative to each module root).abstract org.gradle.api.provider.ListProperty<String> Test class suffixes used by the naming strategy.abstract org.gradle.api.provider.Property<Integer> How many levels of transitive dependencies to follow when thetransitivestrategy is enabled.
-
Constructor Details
-
AffectedTestsExtension
public AffectedTestsExtension()
-
-
Method Details
-
getBaseRef
Git base ref to diff against. Default:"origin/master".- Returns:
- the base ref property
-
getIncludeUncommitted
Include uncommitted (unstaged) changes. Default:true.- Returns:
- the include uncommitted property
-
getIncludeStaged
Include staged changes. Default:true.- Returns:
- the include staged property
-
getRunAllIfNoMatches
Run full test suite if no affected tests are found. Default:false.- Returns:
- the run-all-if-no-matches property
-
getStrategies
Strategies to use for test discovery. Valid values:"naming","usage","impl","transitive". Default: all four.The
transitivestrategy additionally respectstransitiveDepth.- Returns:
- the strategies list property
-
getTransitiveDepth
How many levels of transitive dependencies to follow when thetransitivestrategy is enabled. Default:2. Range: 0–5.- Returns:
- the transitive depth property
-
getTestSuffixes
Test class suffixes used by the naming strategy. Default:["Test", "IT", "ITTest", "IntegrationTest"].- Returns:
- the test suffixes list property
-
getSourceDirs
Production source directories (relative to each module root). Default:["src/main/java"].- Returns:
- the source dirs list property
-
getTestDirs
Test source directories (relative to each module root). Default:["src/test/java"].- Returns:
- the test dirs list property
-
getExcludePaths
Glob patterns for files to exclude from analysis. Default:["**/generated/**"].- Returns:
- the exclude paths list property
-
getIncludeImplementationTests
Include tests for implementations of changed interfaces/base classes. Default:true.- Returns:
- the include implementation tests property
-
getImplementationNaming
Implementation naming suffixes (e.g. "Impl" matches FooBarImpl for FooBar). Default:["Impl"].- Returns:
- the implementation naming list property
-