Bootstrap

GradleTest is available in the Gradle Plugins repository. To use it, add the appropriate plugin to the plugins block.

plugins {
  id 'org.ysb33r.gradletest' version '4.0.2' (1)
  id 'org.ysb33r.gradletest.base' version '4.0.2' (2)
}
1 The common use case for compatibility testing
2 Use the base plugin when you do not require the default gradleTest tasks (and related source sets)

The base plugin will create the gradleTestSourceSets extension, but perform not further configuration.

The standard plugin adds the main sourceSet which will add the gradleTest and gradleTestGenerator tasks. It also adds a convention which acts upto the java-gradle-plugin being applied. In this case it will automatically add the plugin metadata file from the pluginUnderTestMetadata task to the classpath.