From e865d63c29695631b5f93ee46bbfb12cb8d093fd Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Fri, 7 Mar 2014 17:31:44 +0100 Subject: [PATCH] Ensure Gradle does not execute inner classes as tests --- build.gradle | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 0d37e84935c..9a9d5a97450 100644 --- a/build.gradle +++ b/build.gradle @@ -67,7 +67,10 @@ configure(allprojects) { project -> systemProperty("testGroups", project.properties.get("testGroups")) scanForTestClasses = false 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 { @@ -828,19 +831,16 @@ project("spring-test") { task testNG(type: Test) { useTestNG() - // forkEvery 1 - scanForTestClasses = false include(["**/testng/**/*Tests.class", "**/testng/**/*Test.class"]) - exclude "**/Abstract*.class" // Show STD_OUT & STD_ERR of the test JVM(s) on the console: // testLogging.showStandardStreams = true + // forkEvery 1 } test { dependsOn testNG useJUnit() - include(["**/*Tests.class", "**/*Test.class"]) - exclude(["**/Abstract*.class", "**/testng/**/*.*"]) + exclude "**/testng/**/*.*" } task aggregateTestReports(type: TestReport) {