Skip to content
Browse files

fixes #1 - pass test args through to auto test command

  • Loading branch information...
1 parent 3c64e01 commit 473fd068cdfac2b433834e10e823ba31c958c08b Mike Hugo committed Mar 22, 2012
View
6 scripts/AutoTest.groovy
@@ -15,6 +15,7 @@ target(default: "autotest") {
File baseProjectDirectory = new File(basedir)
long interval = 2000
FileListener listener = new FileListener()
+ listener.args = argsMap.params
FileAlterationObserver observer = new FileAlterationObserver(baseProjectDirectory);
observer.addListener(listener)
@@ -29,6 +30,7 @@ target(default: "autotest") {
}
class FileListener extends FileAlterationListenerAdaptor {
Set testsToRun = []
+ Set args
@Synchronized
void onFileChange(File file) {
@@ -51,9 +53,9 @@ class FileListener extends FileAlterationListenerAdaptor {
@Synchronized
void onStop(FileAlterationObserver observer) {
if (testsToRun) {
- String command = "test-app ${testsToRun.join(' ')}"
+ String command = "test-app ${args.join(' ')} ${testsToRun.join(' ')} "
GrailsConsole.getInstance().updateStatus("${testsToRun.size()} files modified, running test-app command with: ${command}")
-
+println command
def parser = GrailsScriptRunner.getCommandLineParser()
def commandLine = parser.parseString(command)
InteractiveMode.current.scriptRunner.executeScriptWithCaching(commandLine)
View
1 test/project/bookstore/grails-app/domain/bookstore/Book.groovy
@@ -3,7 +3,6 @@ package bookstore
class Book {
String title
- String author
static constraints = {
}
View
8 test/project/bookstore/test/integration/bookstore/SimpleIntegrationTests.groovy
@@ -0,0 +1,8 @@
+package bookstore
+
+class SimpleIntegrationTests {
+
+ void testSomething() {
+ assert true
+ }
+}
View
9 test/project/bookstore/test/unit/bookstore/BookTests.groovy
@@ -3,13 +3,12 @@ package bookstore
import grails.test.mixin.*
import org.junit.*
-/**
- * See the API for {@link grails.test.mixin.domain.DomainClassUnitTestMixin} for usage instructions
- */
@TestFor(Book)
class BookTests {
- void testSomething() {
- println "boo!!!"
+ void testTitleIsRequired() {
+ Book book = new Book()
+ book.save()
+ assert "nullable" == book.errors['title'].code
}
}

0 comments on commit 473fd06

Please sign in to comment.
Something went wrong with that request. Please try again.