# Interface JvmTestSuite

All Superinterfaces:
  `Buildable, Named, TestSuite`

@Incubating public interface JvmTestSuite extends TestSuite, Buildable
A test suite is a collection of JVM-based tests.

Each test suite consists of

- A `SourceSet`
- A set of `compile and runtime dependencies`
- One or more `targets`
- A testing framework

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

The default test suite (named `JvmTestSuitePlugin.DEFAULT_TEST_SUITE_NAME`) will default to using the JUnit 4 test framework for backwards compatibility. Any other test suite will default to using the JUnit Jupiter test framework.

Since:
  7.3

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface Named

  `Named.Namer`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `dependencies(Action<? super JvmComponentDependencies> dependencies)`
  Configure dependencies for this component.
  `JvmComponentDependencies`
  `getDependencies()`
  Dependency handler for this component.
  `SourceSet`
  `getSources()`
  Returns the container of `JvmTestSuiteTarget` objects part of this suite.
  `ExtensiblePolymorphicDomainObjectContainer<? extends JvmTestSuiteTarget>`
  `getTargets()`
  Collection of test suite targets.
  `void`
  `sources(Action<? super SourceSet> configuration)`
  Configure the sources for this test suite.
  `void`
  `useJUnit()`
  Use the JUnit4 testing framework.
  `void`
  `useJUnit(String version)`
  Use the JUnit4 testing framework with a specific version.
  `void`
  `useJUnit(Provider<String> version)`
  Use the JUnit4 testing framework with a specific version.
  `void`
  `useJUnitJupiter()`
  Use the JUnit Jupiter testing framework.
  `void`
  `useJUnitJupiter(String version)`
  Use the JUnit Jupiter testing framework with a specific version.
  `void`
  `useJUnitJupiter(Provider<String> version)`
  Use the JUnit Jupiter testing framework with a specific version.
  `void`
  `useKotlinTest()`
  Use the kotlin.test testing framework.
  `void`
  `useKotlinTest(String version)`
  Use the kotlin.test testing framework with a specific version.
  `void`
  `useKotlinTest(Provider<String> version)`
  Use the kotlin.test testing framework with a specific version.
  `void`
  `useSpock()`
  Use the Spock Framework testing framework.
  `void`
  `useSpock(String version)`
  Use the Spock Framework testing framework with a specific version.
  `void`
  `useSpock(Provider<String> version)`
  Use the Spock Framework testing framework with a specific version.
  `void`
  `useTestNG()`
  Use the TestNG testing framework.
  `void`
  `useTestNG(String version)`
  Use the TestNG testing framework with a specific version.
  `void`
  `useTestNG(Provider<String> version)`
  Use the TestNG testing framework with a specific version.

  ### Methods inherited from interface Buildable

  `getBuildDependencies`

  ### Methods inherited from interface Named

  `getName`

- ## Method Details

  - ### getSources

    SourceSet getSources()
    Returns 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.
    Returns:
      source set for this test suite.
    Since:
      7.3

  - ### sources

    void sources(Action<? super SourceSet> configuration)
    Configure the sources for this test suite.
    Parameters:
      `configuration` - configuration applied against the SourceSet for this test suite
    Since:
      7.3

  - ### getTargets

    ExtensiblePolymorphicDomainObjectContainer<? extends JvmTestSuiteTarget> getTargets()
    Collection of test suite targets. Each test suite target executes the tests in this test suite with a particular context and task.
    Specified by:
      `getTargets` in interface `TestSuite`
    Returns:
      collection of test suite targets.

  - ### useJUnitJupiter

    void useJUnitJupiter()
    Use the JUnit Jupiter testing framework.

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

    Since:
      7.3

  - ### useJUnitJupiter

    void useJUnitJupiter(String version)
    Use the JUnit Jupiter testing framework with a specific version.
    Parameters:
      `version` - version of JUnit Jupiter to use
    Since:
      7.3

  - ### useJUnitJupiter

    void useJUnitJupiter(Provider<String> version)
    Use the JUnit Jupiter testing framework with a specific version.
    Parameters:
      `version` - provider supplying the version of JUnit Jupiter to use
    Since:
      7.6

  - ### useJUnit

    void useJUnit()
    Use the JUnit4 testing framework.

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

    Since:
      7.3

  - ### useJUnit

    void useJUnit(String version)
    Use the JUnit4 testing framework with a specific version.
    Parameters:
      `version` - version of JUnit4 to use
    Since:
      7.3

  - ### useJUnit

    void useJUnit(Provider<String> version)
    Use the JUnit4 testing framework with a specific version.
    Parameters:
      `version` - provider supplying the version of JUnit4 to use
    Since:
      7.6

  - ### useSpock

    void useSpock()
    Use the Spock Framework testing framework.

    Gradle will provide the version of Spock to use. Defaults to version `2.3-groovy-4.0`

    Since:
      7.3

  - ### useSpock

    void useSpock(String version)
    Use the Spock Framework testing framework with a specific version.
    Parameters:
      `version` - the version of Spock to use
    Since:
      7.3

  - ### useSpock

    void useSpock(Provider<String> version)
    Use the Spock Framework testing framework with a specific version.
    Parameters:
      `version` - provider supplying the version of Spock to use
    Since:
      7.6

  - ### useKotlinTest

    void useKotlinTest()
    Use the kotlin.test testing framework.

    Gradle will provide the version of kotlin.test to use. Defaults to version `1.6.20`

    Since:
      7.3

  - ### useKotlinTest

    void useKotlinTest(String version)
    Use the kotlin.test testing framework with a specific version.
    Parameters:
      `version` - the version of kotlin.test to use
    Since:
      7.3

  - ### useKotlinTest

    void useKotlinTest(Provider<String> version)
    Use the kotlin.test testing framework with a specific version.
    Parameters:
      `version` - provider supplying the version of kotlin.test to use
    Since:
      7.6

  - ### useTestNG

    void useTestNG()
    Use the TestNG testing framework.

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

    Since:
      7.3

  - ### useTestNG

    void useTestNG(String version)
    Use the TestNG testing framework with a specific version.
    Parameters:
      `version` - version of TestNG to use
    Since:
      7.3

  - ### useTestNG

    void useTestNG(Provider<String> version)
    Use the TestNG testing framework with a specific version.
    Parameters:
      `version` - provider supplying the version of TestNG to use
    Since:
      7.6

  - ### getDependencies

    JvmComponentDependencies getDependencies()
    Dependency handler for this component.
    Returns:
      dependency handler
    Since:
      7.3

  - ### dependencies

    void dependencies(Action<? super JvmComponentDependencies> dependencies)
    Configure dependencies for this component.
    Since:
      7.3