@groovy.transform.CompileStatic @SuppressWarnings(value: MethodCount) class GradleTestSet extends Object implements Named
Defines a GradleTest test set.
Modifiers | Name | Description |
---|---|---|
static java.util.List<String> |
DEFAULT_DEPRECATION_WARNINGS |
Type | Name and description |
---|---|
java.util.List<String> |
defaultDeprecationMessageChecks |
Provider<String> |
defaultTaskToRun |
Provider<DeprecationMessagesMap> |
deprecationMessagesAreFailures |
Provider<File> |
generatedSourceDir |
Provider<URI> |
gradleDistributionURI |
String |
name |
Provider<File> |
sourceDirectory |
Provider<java.util.Set<String>> |
versions |
Constructor and description |
---|
GradleTestSet
(String name, GradleTestSetExtension parent, Project project) |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
augmentMessageChecksForVersionFromDefault(String version, String[] msgPatterns) Initialises a set of messages for a version vy copying the current default set and then adding additional set. |
|
void |
augmentMessageChecksForVersionFromDefault(String version, java.util.Collection<String> msgPatterns) Initialises a set of messages for a version vy copying the current default set and then adding additional set. |
|
void |
configurationCacheMapping(java.util.function.Function<String, ConfigurationCacheMode> mapper) Sets a mapper that determines which Gradle versions should active which kind of configuration cache checks. |
|
void |
configurationCacheMappingByAlias(java.util.function.Function<String, String> mapper) Like configurationCacheMapping, but returns a case-insensitive string value which can then be converted by the test set. |
|
void |
copyNotSymlink() By default, project structures are symlinked back to the files in the project source directory. |
|
void |
defaultDeprecationMessageChecks(String[] msgPatterns) Add deprecation message patterns to the default message sets. |
|
void |
defaultDeprecationMessageChecks(java.util.Collection<String> msgPatterns) Add deprecation message patterns to the default message sets. |
|
void |
deprecationMessageChecksForVersion(String version, java.util.Collection<String> msgPatterns) Modifies the deprecation messages this for a specific Gradle version. |
|
void |
deprecationMessageChecksForVersion(String version, String[] msgPatterns) Modifies the deprecation messages this for a specific Gradle version. |
|
void |
expectedFailures(String[] patterns) Set which tests are expected to fail. |
|
void |
expectedFailures(java.util.regex.Pattern[] patterns) Set which tests are expected to fail. |
|
Provider<Boolean> |
getCleanCache() Whether the Gradle cache should be cleaned before each test tun.. |
|
Provider<java.util.Map<String, ConfigurationCacheMode>> |
getConfigurationCacheModeMapping() A provider that maps configuration cache setup. |
|
Provider<Boolean> |
getCopyOverSymlink() Whether copy should be preferred over symlinks. |
|
String |
getCustomTestManifestTaskName() Returns the name of the task that will generate the Gradle manifest for this test set. |
|
Provider<Boolean> |
getDebug() A provider to indicate debug mode. |
|
java.util.List<String> |
getDefaultDeprecationMessageChecks() Returns the list of default deprecation messages. |
|
Provider<String> |
getDefaultTaskToRun() Name of the task to run inside the Gradle test project. |
|
Provider<DeprecationMessagesMap> |
getDeprecationMessagesAreFailures() Returns a map for every testable version which indicates whether deprecation messages should be checked for that version. |
|
Provider<java.util.List<java.util.regex.Pattern>> |
getExpectedFailures() Test groups which are expected to fail. |
|
Provider<File> |
getGeneratedSourceDir() The top-level directory for sources will be generated into for this source set. |
|
Provider<java.util.List<String>> |
getGradleArguments() Additional arguments to pass to gradle when running the test. |
|
Provider<URI> |
getGradleDistributionURI() Get an alternative location where to get Gradle distributions from. |
|
Provider<String> |
getPackage() The package to be used for tests in this set. |
|
Provider<File> |
getSourceDirectory() The root directory where to find tests for this specific GradleTest grouping The default root directory by convention is src/gradleTest . |
|
Provider<TestKitLocations> |
getTestKitStrategy() A strategy for storing TestKit related data. |
|
String |
getTestSourceGeneratorTaskName() Returns the name of the task that will generate source for this test set. |
|
String |
getTestTaskName() Returns the name of the test task associated with this test set. |
|
Provider<java.util.Set<String>> |
getVersions() Returns the set of Gradle versions to tests against. |
|
void |
gradleArguments(Object[] args) Additional Gradle arguments to pass. |
|
void |
gradleArguments(java.util.List<Object> args) Additional Gradle arguments to pass. |
|
void |
replaceDeprecationMessageChecksForVersion(String version, java.util.Collection<String> msgPatterns) Replaces the current set of messages for a specific version with a new set.. |
|
void |
setCleanCache(boolean flag) Whether cache should be clean before each test run. |
|
void |
setDebug(boolean flag) Whether debug should be enabled for tests. |
|
void |
setDefaultDeprecationMessageChecks(java.util.Collection<String> msgPatterns) Replace the set of default deprevation messages. |
|
void |
setDefaultTaskToRun(String taskName) Overrides the default task to run inside the Gradle test project. |
|
void |
setDeprecationMessagesAreFailures(java.util.function.Predicate<String> forVersions) Set whether deprecation message should fail the build. |
|
void |
setDeprecationMessagesAreFailuresForAllVersions(Boolean flag) Turns deprecation checking on or off for all Gradle versions. |
|
void |
setGeneratedSourceDir(Object out) Override the directory where sources are generated into. |
|
void |
setGradleDistributionURI(Object uri) Sets the location of where to fetch Gradle distributions from. |
|
void |
setSourceDirectory(Object src) Overrides the default location of test project sources. |
|
void |
setVersions(java.util.Collection<Object> ver) Replace all previously defined versions. |
|
void |
testKitDirectoryPerGroup() Keep the Testkit data, but share the directory between the complete testset. |
|
void |
testKitDirectoryPerTest() Keep one TestKit directory per test. |
|
void |
testKitDirectoryShared() Shares the testkit directory between all tests. |
|
void |
useCustomManifest() Indicate that a custom manifest file must be used. |
|
void |
versions(Object[] ver) Add Gradle versions to be tested against. |
|
void |
versions(Iterable<Object> ver) Add Gradle versions to be tested against. |
Initialises a set of messages for a version vy copying the current default set and then adding additional set.
Once this method is called, even if no mods are made, the specific Gradle version will no longer use the default set.
version
- Gradle version to customiseInitialises a set of messages for a version vy copying the current default set and then adding additional set.
Once this method is called, even if no mods are made, the specific Gradle version will no longer use the default set.
version
- Gradle version to customiseSets a mapper that determines which Gradle versions should active which kind of configuration cache checks.
mapper
- Gradle version in, cache-mode out.Like configurationCacheMapping, but returns a case-insensitive string value which can then be converted by the test set.
This makes it easier to use in a DSL.
mapper
- Gradle version in, cache-mode string value out.By default, project structures are symlinked back to the files in the project source directory. This saves a lot of disk space and speeds things up. This can cause issues if the test writes anything back into directory that was symlinked. This behaviour can be turned off, so that everything is copied.
When turned off, directories are copied, but single files at the toplevel of the project are still symlinked.
Add deprecation message patterns to the default message sets.
msgPatterns
- Additional set of patternsAdd deprecation message patterns to the default message sets.
msgPatterns
- Additional set of patternsModifies the deprecation messages this for a specific Gradle version.
Once this method is called, even if no mods are made, the specific Gradle version will no longer use the default set.
version
- Gradle version to customiseModifies the deprecation messages this for a specific Gradle version.
Once this method is called, even if no mods are made, the specific Gradle version will no longer use the default set.
version
- Gradle version to customiseSet which tests are expected to fail.
patterns
- Regex patterns. These should match the name of the GradleTest folder i.e.
for src/gradleTest/myTest
,
then it should try to match on myTest
.Set which tests are expected to fail.
patterns
- Regex patterns. These should match the name of the GradleTest folder i.e.
for src/gradleTest/myTest
,
then it should try to match on myTest
.Whether the Gradle cache should be cleaned before each test tun..
The default is to clean the cache. Not cleaning the cache results in slightly faster runs, but can have hard-to-diagnose issues.
@returnA provider that maps configuration cache setup.
Whether copy should be preferred over symlinks.
The default is to use symlinks.
Returns the name of the task that will generate the Gradle manifest for this test set.
This will return a name, but this does no guarantee that it will be used. In order for it to be used, useCustomManifest has to be called.
Returns the list of default deprecation messages.
This list can be modified and messages added or removed.
Name of the task to run inside the Gradle test project.
The default is runGradleTest
.
Returns a map for every testable version which indicates whether deprecation messages should be checked for that version.
If deprecation warnings should not be checked the list of test patterns will be empty, otherwise it will contain a list of regex patterns.
Test groups which are expected to fail.
The top-level directory for sources will be generated into for this source set.
Additional arguments to pass to gradle when running the test.
Get an alternative location where to get Gradle distributions from.
The location is expected to store Gradle packages in the standard format.
The root directory where to find tests for this specific GradleTest grouping
The default root directory by convention is src/gradleTest
. The patterns for the
directory is src/
+ gradleTestSetName
.
project.file ( )
.A strategy for storing TestKit related data. The default is to discard testkit data after tests.
Returns the name of the task that will generate source for this test set.
Returns the name of the test task associated with this test set.
Returns the set of Gradle versions to tests against.
If a Gradle or system property similar to gradleTest.versions
or an environment variable similar to
GRADLETEST_VERSIONS
is specified, it will return the versions parsed from that instead.
Additional Gradle arguments to pass.
args
- Command-line arguments.Additional Gradle arguments to pass.
args
- Command-line arguments.Replaces the current set of messages for a specific version with a new set..
Once this method is called, even if no mods are made, the specific Gradle version will no longer use the default set.
version
- Gradle version to customiseWhether cache should be clean before each test run.
flag
- false
turns cache cleaning off..Whether debug should be enabled for tests.
Even if debug is et, for certain tests, it might remain disabled, especially for older version of Gradle with Kotlin DSL, or for configuration cache.
flag
- true
turns debug on.Replace the set of default deprevation messages.
msgPatterns
- New set of patterns.Overrides the default task to run inside the Gradle test project.
taskName
- New task nameSet whether deprecation message should fail the build.
Overrides previous calls to setDeprecationMessagesAreFailuresForAllVersions.
forVersions
- Indicates for which Gradle test versions, deprecation versions should be checked.Turns deprecation checking on or off for all Gradle versions.
Overrides previous calls to setDeprecationMessagesAreFailures.
flag
- true
turns on warnings check for all versions.Override the directory where sources are generated into.
out
- Target directorySets the location of where to fetch Gradle distributions from.
uri
- Location URI. Can be a string or a File, or anything that can be converted to a URI.Overrides the default location of test project sources.
src
- The location of the gradle test project sources.Replace all previously defined versions.
ver
- List of versions.
The values are evaluated immediately.Keep the Testkit data, but share the directory between the complete testset.
Keep one TestKit directory per test. This options uses the most space, but allows detailed analysis per test.
Shares the testkit directory between all tests. Tests run slightly faster, but problems can be harder to diagnose.
Indicate that a custom manifest file must be used.
This will use a custom manifest, even if the java-gradle-plugin
has been applied.
It will use the runtime classpath for the source set of this test set.
Additional dependencies can be added to the runtimeOnly
configuration of the source set associated
with this testset.
This will be gradleTestRuntimeOnly
for the main
testset or something like
myExtraGradleTestRuntimeOnly
for a test set called myExtra
.
This also adds a task called gradleTestClasspathManifest
.
For a test set called myExtra
, it will be called myExtraGradleTestClasspathManifest
.
Add Gradle versions to be tested against.
ver
- List of versionsGroovy Documentation