Skip to content

Commit a7aecbb

Browse files
committed
Ensure spring-test test tasks are UP-TO-DATE
See also: 6921442 and eec183e
1 parent d036b5a commit a7aecbb

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ configure(allprojects) { project ->
139139
// classes with the "$" pattern; otherwise, using -Dtest.single=MyTests to
140140
// run MyTests by itself will fail if MyTests contains any inner classes.
141141
exclude(["**/Abstract*.class", '**/*$*'])
142-
reports.junitXml.setDestination(file("$buildDir/test-results"))
143142
}
144143

145144
checkstyle {

spring-test/spring-test.gradle

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,16 @@ dependencies {
8787
testRuntime("com.sun.xml.bind:jaxb-impl:2.3.0.1")
8888
}
8989

90-
task testNG(type: Test) {
91-
description = "Runs TestNG tests."
92-
useTestNG()
90+
task junit4(type: Test) {
91+
description = "Runs JUnit 4 tests."
92+
useJUnit()
93+
systemProperty("testGroups", project.properties.get("testGroups"))
9394
scanForTestClasses = false
94-
include(["**/testng/**/*Tests.class", "**/testng/**/*Test.class"])
95-
// Show STD_OUT & STD_ERR of the test JVM(s) on the console:
96-
// testLogging.showStandardStreams = true
97-
// forkEvery 1
98-
reports.junitXml.destination = file("$buildDir/test-results")
95+
include(["**/*Tests.class", "**/*Test.class"])
96+
exclude(["**/Abstract*.class", "**/testng/**/*.*", "**/jupiter/**/*.*"])
9997
}
10098

101-
task testJUnitJupiter(type: Test) {
99+
task junitJupiter(type: Test) {
102100
description = "Runs JUnit Jupiter tests."
103101
useJUnitPlatform {
104102
includeEngines "junit-jupiter"
@@ -107,25 +105,32 @@ task testJUnitJupiter(type: Test) {
107105
filter {
108106
includeTestsMatching "org.springframework.test.context.junit.jupiter.*"
109107
}
110-
reports.junitXml.destination = file("$buildDir/test-results")
108+
systemProperty("testGroups", project.properties.get("testGroups"))
111109
// Java Util Logging for the JUnit Platform.
112110
// systemProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager")
113111
}
114112

115-
test {
116-
description = "Runs JUnit 4 tests."
117-
dependsOn testJUnitJupiter, testNG
118-
useJUnit()
113+
task testNG(type: Test) {
114+
description = "Runs TestNG tests."
115+
useTestNG()
116+
systemProperty("testGroups", project.properties.get("testGroups"))
119117
scanForTestClasses = false
120-
include(["**/*Tests.class", "**/*Test.class"])
121-
exclude(["**/testng/**/*.*", "**/jupiter/**/*.*"])
122-
reports.junitXml.destination = file("$buildDir/test-results")
118+
include(["**/testng/**/*Tests.class", "**/testng/**/*Test.class"])
119+
// Show STD_OUT & STD_ERR of the test JVM(s) on the console:
120+
// testLogging.showStandardStreams = true
121+
// forkEvery 1
122+
}
123+
124+
test {
125+
description = "Runs all tests."
126+
dependsOn junit4, junitJupiter, testNG
127+
exclude(["**/*.*"])
123128
}
124129

125130
task aggregateTestReports(type: TestReport) {
126131
description = "Aggregates JUnit and TestNG test reports."
127132
destinationDir = test.reports.html.destination
128-
reportOn test, testJUnitJupiter, testNG
133+
reportOn junit4, junitJupiter, testNG
129134
}
130135

131136
check.dependsOn aggregateTestReports

0 commit comments

Comments
 (0)