From 4d50d2d0547eb4f3b6ded90760b03a8c98741540 Mon Sep 17 00:00:00 2001 From: "David B." <997605+DevDavido@users.noreply.github.com> Date: Wed, 9 Oct 2024 08:31:40 +0200 Subject: [PATCH] build: Migrate to explicit non-deprecated Gradle test suite configuration (#100428) --- README.asciidoc | 2 +- build.gradle.kts | 31 ++++++++++++++----- .../test/AbstractIntegrationKotlinSpec.groovy | 4 --- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index 60f1302..c6040c6 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -21,7 +21,7 @@ To use the Gradle Test Plugin, add the following lines to your build script: tasks { withType().configureEach { //Set supported Gradle version - systemProperty("intershop.gradle.versions", "8.4,8.5") + systemProperty("intershop.gradle.versions", "8.4,8.5,8.10.2") //working dir for tests systemProperty("intershop.test.base.dir", project.layout.buildDirectory.get().dir("test-working").asFile.absolutePath) } diff --git a/build.gradle.kts b/build.gradle.kts index 45ed1a4..1d4352a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,6 +19,7 @@ import org.asciidoctor.gradle.jvm.AsciidoctorTask plugins { `java-library` + `jvm-test-suite` // project plugins groovy // test coverage @@ -59,18 +60,32 @@ if (project.version.toString().endsWith("-SNAPSHOT")) { status = "snapshot'" } -tasks { - - withType().configureEach { - testLogging.showStandardStreams = true +testing { + suites { + val test by getting(JvmTestSuite::class) { + useSpock() - // Gradle versions for test - systemProperty("intershop.gradle.versions", "8.4,8.5,8.10.2") - systemProperty("intershop.test.base.dir", project.layout.buildDirectory.dir("test-working").get().asFile.absolutePath) + dependencies { + implementation(gradleTestKit()) + } - useJUnitPlatform() + targets { + all { + testTask.configure { + // Gradle versions for test + systemProperty("intershop.gradle.versions", "8.4,8.5,8.10.2") + systemProperty("intershop.test.base.dir", project.layout.buildDirectory.dir("test-working").get().asFile.absolutePath) + options { + testLogging.showStandardStreams = true + } + } + } + } + } } +} +tasks { val asciidoctorSrc = project.layout.buildDirectory.dir("/tmp/asciidoctorSrc") register("copyAsciiDoc") { diff --git a/src/main/groovy/com/intershop/gradle/test/AbstractIntegrationKotlinSpec.groovy b/src/main/groovy/com/intershop/gradle/test/AbstractIntegrationKotlinSpec.groovy index c3f1112..78f4996 100644 --- a/src/main/groovy/com/intershop/gradle/test/AbstractIntegrationKotlinSpec.groovy +++ b/src/main/groovy/com/intershop/gradle/test/AbstractIntegrationKotlinSpec.groovy @@ -15,11 +15,7 @@ */ package com.intershop.gradle.test -import com.intershop.gradle.test.util.TestDir import groovy.util.logging.Slf4j -import org.apache.commons.io.FileUtils -import org.gradle.testkit.runner.GradleRunner -import spock.lang.Specification /** * This abstract spec implements a special