:samples-dir: /home/tcagent1/agent/work/64493a816be20d5a/promote-projects/gradle/build/git-checkout/platforms/documentation/docs/build/working/samples/install/jvm-multi-project-with-additional-test-types
:gradle-version: 9.0.0-rc-4

= Using additional test types Sample

[.download]
- link:zips/sample_jvm_multi_project_with_additional_test_types-groovy-dsl.zip[icon:download[] Groovy DSL]
- link:zips/sample_jvm_multi_project_with_additional_test_types-kotlin-dsl.zip[icon:download[] Kotlin DSL]

NOTE: You can open this sample in an link:{userManualPath}/gradle_ides.html#gradle_ides[IDE that supports Gradle].

This sample shows how to add additional test types to a JVM project in Gradle. Your project may have many different kinds of tests--unit tests, integration tests, functional tests, etc. A JVM project in Gradle has a single `Test` task, but other tasks can be added to represent each of these test types.

In this sample, we are testing Java projects with JUnit5; however, this applies to other JVM languages as well.

Concretely, we add a _convention plugin_ in `buildSrc` to share the integration test setup between multiple subprojects:

====
include::sample[dir="kotlin",files="buildSrc/src/main/kotlin/myproject.java-conventions.gradle.kts[]"]
include::sample[dir="groovy",files="buildSrc/src/main/groovy/myproject.java-conventions.gradle[]"]
====

And apply it in an application project:

====
include::sample[dir="kotlin",files="application/build.gradle.kts[]"]
include::sample[dir="groovy",files="application/build.gradle[]"]
====

And in library projects:

====
include::sample[dir="kotlin",files="utilities/build.gradle.kts[]"]
include::sample[dir="groovy",files="utilities/build.gradle[]"]
====

These additional tests can be executed with the `integrationTest` task or as part of lifecycle `check`:

[listing.terminal.sample-command]
----
$ ./gradlew check

BUILD SUCCESSFUL
14 actionable tasks: 14 executed
----

For more information, see link:{userManualPath}/java_testing.html#sec:configuring_java_integration_tests[section Configuring integration tests in the Testing in Java project chapter].
