@@ -87,18 +87,16 @@ dependencies {
87
87
testRuntime(" com.sun.xml.bind:jaxb-impl:2.3.0.1" )
88
88
}
89
89
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" ))
93
94
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/**/*.*" ])
99
97
}
100
98
101
- task testJUnitJupiter (type : Test ) {
99
+ task junitJupiter (type : Test ) {
102
100
description = " Runs JUnit Jupiter tests."
103
101
useJUnitPlatform {
104
102
includeEngines " junit-jupiter"
@@ -107,25 +105,32 @@ task testJUnitJupiter(type: Test) {
107
105
filter {
108
106
includeTestsMatching " org.springframework.test.context.junit.jupiter.*"
109
107
}
110
- reports . junitXml . destination = file( " $b uildDir /test-results " )
108
+ systemProperty( " testGroups " , project . properties . get( " testGroups " ) )
111
109
// Java Util Logging for the JUnit Platform.
112
110
// systemProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager")
113
111
}
114
112
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 " ) )
119
117
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([" **/*.*" ])
123
128
}
124
129
125
130
task aggregateTestReports (type : TestReport ) {
126
131
description = " Aggregates JUnit and TestNG test reports."
127
132
destinationDir = test. reports. html. destination
128
- reportOn test, testJUnitJupiter , testNG
133
+ reportOn junit4, junitJupiter , testNG
129
134
}
130
135
131
136
check. dependsOn aggregateTestReports
0 commit comments