Ensure Gradle does not execute inner classes as tests

This commit is contained in:
Sam Brannen 2014-03-07 17:31:44 +01:00
parent bcde955ec9
commit e865d63c29
1 changed files with 6 additions and 6 deletions

View File

@ -67,7 +67,10 @@ configure(allprojects) { project ->
systemProperty("testGroups", project.properties.get("testGroups")) systemProperty("testGroups", project.properties.get("testGroups"))
scanForTestClasses = false scanForTestClasses = false
include(["**/*Tests.class", "**/*Test.class"]) include(["**/*Tests.class", "**/*Test.class"])
exclude "**/Abstract*.class" // Since we set scanForTestClasses to false, we need to filter out inner
// 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", '**/*$*'])
} }
repositories { repositories {
@ -828,19 +831,16 @@ project("spring-test") {
task testNG(type: Test) { task testNG(type: Test) {
useTestNG() useTestNG()
// forkEvery 1
scanForTestClasses = false
include(["**/testng/**/*Tests.class", "**/testng/**/*Test.class"]) include(["**/testng/**/*Tests.class", "**/testng/**/*Test.class"])
exclude "**/Abstract*.class"
// Show STD_OUT & STD_ERR of the test JVM(s) on the console: // Show STD_OUT & STD_ERR of the test JVM(s) on the console:
// testLogging.showStandardStreams = true // testLogging.showStandardStreams = true
// forkEvery 1
} }
test { test {
dependsOn testNG dependsOn testNG
useJUnit() useJUnit()
include(["**/*Tests.class", "**/*Test.class"]) exclude "**/testng/**/*.*"
exclude(["**/Abstract*.class", "**/testng/**/*.*"])
} }
task aggregateTestReports(type: TestReport) { task aggregateTestReports(type: TestReport) {