From a7aecbb4dc59b6a88d7b35e63db7657e14a3e8ea Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Thu, 5 Sep 2019 15:06:12 +0200 Subject: [PATCH] Ensure spring-test test tasks are UP-TO-DATE See also: 69214429df2ec644da6e and eec183ef2840d0e3cc20 --- build.gradle | 1 - spring-test/spring-test.gradle | 41 +++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index 0b9bdc234f0..cbfa4914f28 100644 --- a/build.gradle +++ b/build.gradle @@ -139,7 +139,6 @@ configure(allprojects) { project -> // classes with the "$" pattern; otherwise, using -Dtest.single=MyTests to // run MyTests by itself will fail if MyTests contains any inner classes. exclude(["**/Abstract*.class", '**/*$*']) - reports.junitXml.setDestination(file("$buildDir/test-results")) } checkstyle { diff --git a/spring-test/spring-test.gradle b/spring-test/spring-test.gradle index b43e6c5a3a5..5d6507a2601 100644 --- a/spring-test/spring-test.gradle +++ b/spring-test/spring-test.gradle @@ -87,18 +87,16 @@ dependencies { testRuntime("com.sun.xml.bind:jaxb-impl:2.3.0.1") } -task testNG(type: Test) { - description = "Runs TestNG tests." - useTestNG() +task junit4(type: Test) { + description = "Runs JUnit 4 tests." + useJUnit() + systemProperty("testGroups", project.properties.get("testGroups")) scanForTestClasses = false - include(["**/testng/**/*Tests.class", "**/testng/**/*Test.class"]) - // Show STD_OUT & STD_ERR of the test JVM(s) on the console: - // testLogging.showStandardStreams = true - // forkEvery 1 - reports.junitXml.destination = file("$buildDir/test-results") + include(["**/*Tests.class", "**/*Test.class"]) + exclude(["**/Abstract*.class", "**/testng/**/*.*", "**/jupiter/**/*.*"]) } -task testJUnitJupiter(type: Test) { +task junitJupiter(type: Test) { description = "Runs JUnit Jupiter tests." useJUnitPlatform { includeEngines "junit-jupiter" @@ -107,25 +105,32 @@ task testJUnitJupiter(type: Test) { filter { includeTestsMatching "org.springframework.test.context.junit.jupiter.*" } - reports.junitXml.destination = file("$buildDir/test-results") + systemProperty("testGroups", project.properties.get("testGroups")) // Java Util Logging for the JUnit Platform. // systemProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager") } -test { - description = "Runs JUnit 4 tests." - dependsOn testJUnitJupiter, testNG - useJUnit() +task testNG(type: Test) { + description = "Runs TestNG tests." + useTestNG() + systemProperty("testGroups", project.properties.get("testGroups")) scanForTestClasses = false - include(["**/*Tests.class", "**/*Test.class"]) - exclude(["**/testng/**/*.*", "**/jupiter/**/*.*"]) - reports.junitXml.destination = file("$buildDir/test-results") + include(["**/testng/**/*Tests.class", "**/testng/**/*Test.class"]) + // Show STD_OUT & STD_ERR of the test JVM(s) on the console: + // testLogging.showStandardStreams = true + // forkEvery 1 +} + +test { + description = "Runs all tests." + dependsOn junit4, junitJupiter, testNG + exclude(["**/*.*"]) } task aggregateTestReports(type: TestReport) { description = "Aggregates JUnit and TestNG test reports." destinationDir = test.reports.html.destination - reportOn test, testJUnitJupiter, testNG + reportOn junit4, junitJupiter, testNG } check.dependsOn aggregateTestReports