JvmTestSuite

API Documentation:JvmTestSuite

Note: This class is incubating and may change in a future version of Gradle.

A test suite is a collection of JVM-based tests.

Each test suite consists of

Based on the testing framework declared, Gradle will automatically add the appropriate dependencies and configure the underlying test task.

Properties

PropertyDescription
buildDependencies

Returns a dependency which contains the tasks which build this artifact. All Buildable implementations must ensure that the returned dependency object is live, so that it tracks changes to the dependencies of this buildable.

dependencies
Incubating

Dependency handler for this component.

sources
Incubating

The container of JvmTestSuiteTarget objects part of this suite. Source set associated with this test suite. The name of this source set is the same as the test suite.

targets
Incubating

Collection of test suite targets. Each test suite target executes the tests in this test suite with a particular context and task.

testType
Incubating

Get the test type for this test suite. Defaults to the value of the UNIT_TEST constant defined in TestSuiteType for the built-in test suite, and to the dash-case name of the test suite for custom test suites. Test suite types must be unique across all test suites within a project.

Methods

MethodDescription
useJUnit()
Incubating

Use the JUnit4 testing framework.

useJUnit(version)
Incubating

Use the JUnit4 testing framework with a specific version.

useJUnit(version)
Incubating

Use the JUnit4 testing framework with a specific version.

useJUnitJupiter()
Incubating

Use the JUnit Jupiter testing framework.

useJUnitJupiter(version)
Incubating

Use the JUnit Jupiter testing framework with a specific version.

useJUnitJupiter(version)
Incubating

Use the JUnit Jupiter testing framework with a specific version.

useSpock()
Incubating

Use the Spock Framework testing framework.

useSpock(version)
Incubating

Use the Spock Framework testing framework with a specific version.

useSpock(version)
Incubating

Use the Spock Framework testing framework with a specific version.

useTestNG()
Incubating

Use the TestNG testing framework.

useTestNG(version)
Incubating

Use the TestNG testing framework with a specific version.

useTestNG(version)
Incubating

Use the TestNG testing framework with a specific version.

Script blocks

No script blocks

Property details

TaskDependency buildDependencies (read-only)

Returns a dependency which contains the tasks which build this artifact. All Buildable implementations must ensure that the returned dependency object is live, so that it tracks changes to the dependencies of this buildable.

JvmComponentDependencies dependencies (read-only)

Note: This property is incubating and may change in a future version of Gradle.

Dependency handler for this component.

SourceSet sources (read-only)

Note: This property is incubating and may change in a future version of Gradle.

The container of JvmTestSuiteTarget objects part of this suite. Source set associated with this test suite. The name of this source set is the same as the test suite.

Note: This property is incubating and may change in a future version of Gradle.

Collection of test suite targets. Each test suite target executes the tests in this test suite with a particular context and task.

Property<String> testType

Note: This property is incubating and may change in a future version of Gradle.

Get the test type for this test suite. Defaults to the value of the UNIT_TEST constant defined in TestSuiteType for the built-in test suite, and to the dash-case name of the test suite for custom test suites. Test suite types must be unique across all test suites within a project.

Method details

void useJUnit()

Note: This method is incubating and may change in a future version of Gradle.

Use the JUnit4 testing framework.

Gradle will provide the version of JUnit4 to use. Defaults to version 4.13.2

void useJUnit(String version)

Note: This method is incubating and may change in a future version of Gradle.

Use the JUnit4 testing framework with a specific version.

void useJUnit(Provider<String> version)

Note: This method is incubating and may change in a future version of Gradle.

Use the JUnit4 testing framework with a specific version.

void useJUnitJupiter()

Note: This method is incubating and may change in a future version of Gradle.

Use the JUnit Jupiter testing framework.

Gradle will provide the version of JUnit Jupiter to use. Defaults to version 5.8.2

void useJUnitJupiter(String version)

Note: This method is incubating and may change in a future version of Gradle.

Use the JUnit Jupiter testing framework with a specific version.

void useJUnitJupiter(Provider<String> version)

Note: This method is incubating and may change in a future version of Gradle.

Use the JUnit Jupiter testing framework with a specific version.

void useSpock()

Note: This method is incubating and may change in a future version of Gradle.

Use the Spock Framework testing framework.

Gradle will provide the version of Spock to use. Defaults to version 2.2-groovy-3.0

void useSpock(String version)

Note: This method is incubating and may change in a future version of Gradle.

Use the Spock Framework testing framework with a specific version.

void useSpock(Provider<String> version)

Note: This method is incubating and may change in a future version of Gradle.

Use the Spock Framework testing framework with a specific version.

void useTestNG()

Note: This method is incubating and may change in a future version of Gradle.

Use the TestNG testing framework.

Gradle will provide the version of TestNG to use. Defaults to version 7.4.0

void useTestNG(String version)

Note: This method is incubating and may change in a future version of Gradle.

Use the TestNG testing framework with a specific version.

void useTestNG(Provider<String> version)

Note: This method is incubating and may change in a future version of Gradle.

Use the TestNG testing framework with a specific version.