Skip to content

Commit 24239c5

Browse files
author
pledbrook
committed
It is now possible to specify the tests to run even when the test classes
reside in packages. git-svn-id: https://svn.codehaus.org/grails/trunk@6479 1cfb16fd-6d17-0410-8ff1-b7e8e1e2867d
1 parent aeea0de commit 24239c5

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

scripts/TestApp.groovy

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ target(testApp: "The test app implementation target") {
102102
runIntegrationTests()
103103
produceReports()
104104
}
105+
catch (Exception ex) {
106+
ex.printStackTrace()
107+
}
105108
finally {
106109
processResults()
107110
}
@@ -380,5 +383,23 @@ def resolveTestResources(patternResolver) {
380383
}
381384

382385
def getTestNames(testNamesString) {
383-
testNamesString ? testNamesString.tokenize().collect {"${it}Tests"} : null
386+
// If a list of test class names is provided, split it into ant
387+
// file patterns.
388+
if (testNamesString) {
389+
testNamesString = testNamesString.split(/\s+/).collect {
390+
// If the test name includes a package, replace it with the
391+
// corresponding file path.
392+
if (it.indexOf('.') != -1) {
393+
it = it.replace('.' as char, '/' as char)
394+
}
395+
else {
396+
// Allow the test class to be in any package.
397+
it = "**/$it"
398+
}
399+
400+
return "${it}Tests"
401+
}
402+
}
403+
404+
return testNamesString
384405
}

0 commit comments

Comments
 (0)