Skip to content

Commit 670cbb9

Browse files
committed
Simplify Gradle test task configuration
As an added bonus, AbstractViewTests is now executed in the build.
1 parent 280a1b8 commit 670cbb9

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

build.gradle

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,16 +317,11 @@ configure([rootProject] + javaProjects) { project ->
317317
}
318318

319319
test {
320+
useJUnitPlatform()
321+
include(["**/*Tests.class", "**/*Test.class"])
320322
systemProperty("java.awt.headless", "true")
321323
systemProperty("testGroups", project.properties.get("testGroups"))
322324
systemProperty("io.netty.leakDetection.level", "paranoid")
323-
useJUnitPlatform()
324-
scanForTestClasses = false
325-
include(["**/*Tests.class", "**/*Test.class"])
326-
// Since we set scanForTestClasses to false, we need to filter out inner
327-
// classes with the "$" pattern; otherwise, using -Dtest.single=MyTests to
328-
// run MyTests by itself will fail if MyTests contains any inner classes.
329-
exclude(["**/Abstract*.class", '**/*$*'])
330325
}
331326

332327
checkstyle {

spring-test/spring-test.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,21 @@ dependencies {
7474

7575
task junit(type: Test) {
7676
description = "Runs JUnit 4 and JUnit Jupiter tests."
77-
systemProperty("testGroups", project.properties.get("testGroups"))
7877
useJUnitPlatform {
7978
excludeTags "failing-test-case"
8079
}
8180
include(["**/*Tests.class", "**/*Test.class"])
8281
exclude(["**/testng/**/*.*"])
82+
systemProperty("testGroups", project.properties.get("testGroups"))
8383
// Java Util Logging for the JUnit Platform.
8484
// systemProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager")
8585
}
8686

8787
task testNG(type: Test) {
8888
description = "Runs TestNG tests."
89-
systemProperty("testGroups", project.properties.get("testGroups"))
9089
useTestNG()
91-
scanForTestClasses = false
9290
include(["**/testng/**/*Tests.class", "**/testng/**/*Test.class"])
91+
systemProperty("testGroups", project.properties.get("testGroups"))
9392
// Show STD_OUT & STD_ERR of the test JVM(s) on the console:
9493
// testLogging.showStandardStreams = true
9594
// forkEvery 1

0 commit comments

Comments
 (0)