This abstract test case makes it easy to run a Grails command and query its output. It's currently configured via a set of system properties:
Fields inherited from class | Fields |
---|---|
class groovy.util.GroovyTestCase |
TEST_SCRIPT_NAME_PREFIX |
Type Params | Return Type | Name and description |
---|---|---|
|
void |
enterInput(java.lang.String input) Allows you to provide user input for any commands that require it. |
|
protected void |
execute(java.util.List<java.lang.String> command) Executes a Grails command. |
|
java.lang.String |
getOutput() Returns the process output as a string. |
|
java.io.File |
getWorkDir() Returns the working directory for the current command. |
|
boolean |
isWindows() |
|
void |
setOutput(java.lang.String output) |
|
void |
setWorkDir(java.io.File dir) |
|
protected void |
signalDone() Signals any threads waiting on condition to inform them that the process output stream has been read. |
|
protected void |
verifyHeader() Checks that the output of the current command starts with the expected header, which includes the Grails version and the location of GRAILS_HOME. |
|
int |
waitForProcess() Waits for the current command to finish executing. |
Methods inherited from class | Name |
---|---|
class groovy.util.GroovyTestCase |
groovy.util.GroovyTestCase#getName(), groovy.util.GroovyTestCase#getMethodName(), groovy.util.GroovyTestCase#assertEquals(java.lang.String, java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#assertEquals(java.lang.String, java.lang.String), groovy.util.GroovyTestCase#assertEquals(java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#notYetImplemented(), groovy.util.GroovyTestCase#notYetImplemented(java.lang.Object), groovy.util.GroovyTestCase#run(), groovy.util.GroovyTestCase#run(junit.framework.TestResult), groovy.util.GroovyTestCase#toString(), groovy.util.GroovyTestCase#format(java.lang.String, java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#setName(java.lang.String), groovy.util.GroovyTestCase#fail(java.lang.String), groovy.util.GroovyTestCase#fail(), groovy.util.GroovyTestCase#assertNotNull(java.lang.String, java.lang.Object), groovy.util.GroovyTestCase#assertNotNull(java.lang.Object), groovy.util.GroovyTestCase#assertTrue(java.lang.String, boolean), groovy.util.GroovyTestCase#assertTrue(boolean), groovy.util.GroovyTestCase#countTestCases(), groovy.util.GroovyTestCase#assertEquals(java.lang.String, short, short), groovy.util.GroovyTestCase#assertEquals(char, char), groovy.util.GroovyTestCase#assertEquals(java.lang.String, char, char), groovy.util.GroovyTestCase#assertEquals(byte, byte), groovy.util.GroovyTestCase#assertEquals(java.lang.String, byte, byte), groovy.util.GroovyTestCase#assertEquals(boolean, boolean), groovy.util.GroovyTestCase#assertEquals(int, int), groovy.util.GroovyTestCase#assertEquals(java.lang.String, int, int), groovy.util.GroovyTestCase#assertEquals(short, short), groovy.util.GroovyTestCase#assertEquals(java.lang.String, float, float, float), groovy.util.GroovyTestCase#assertEquals(double, double, double), groovy.util.GroovyTestCase#assertEquals(java.lang.String, java.lang.String, java.lang.String), groovy.util.GroovyTestCase#assertEquals(java.lang.String, double, double, double), groovy.util.GroovyTestCase#assertEquals(java.lang.String, boolean, boolean), groovy.util.GroovyTestCase#assertEquals(long, long), groovy.util.GroovyTestCase#assertEquals(java.lang.String, long, long), groovy.util.GroovyTestCase#assertEquals(float, float, float), groovy.util.GroovyTestCase#runBare(), groovy.util.GroovyTestCase#assertFalse(boolean), groovy.util.GroovyTestCase#assertFalse(java.lang.String, boolean), groovy.util.GroovyTestCase#assertNull(java.lang.Object), groovy.util.GroovyTestCase#assertNull(java.lang.String, java.lang.Object), groovy.util.GroovyTestCase#assertSame(java.lang.String, java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#assertSame(java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#assertNotSame(java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#assertNotSame(java.lang.String, java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#failSame(java.lang.String), groovy.util.GroovyTestCase#failNotSame(java.lang.String, java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#failNotEquals(java.lang.String, java.lang.Object, java.lang.Object), groovy.util.GroovyTestCase#wait(long, int), groovy.util.GroovyTestCase#wait(long), groovy.util.GroovyTestCase#wait(), groovy.util.GroovyTestCase#equals(java.lang.Object), groovy.util.GroovyTestCase#hashCode(), groovy.util.GroovyTestCase#getClass(), groovy.util.GroovyTestCase#notify(), groovy.util.GroovyTestCase#notifyAll() |
class junit.framework.TestCase |
junit.framework.TestCase#run(), junit.framework.TestCase#run(junit.framework.TestResult), junit.framework.TestCase#toString(), junit.framework.TestCase#getName(), junit.framework.TestCase#format(java.lang.String, java.lang.Object, java.lang.Object), junit.framework.TestCase#setName(java.lang.String), junit.framework.TestCase#fail(java.lang.String), junit.framework.TestCase#fail(), junit.framework.TestCase#assertNotNull(java.lang.String, java.lang.Object), junit.framework.TestCase#assertNotNull(java.lang.Object), junit.framework.TestCase#assertTrue(java.lang.String, boolean), junit.framework.TestCase#assertTrue(boolean), junit.framework.TestCase#countTestCases(), junit.framework.TestCase#assertEquals(java.lang.String, short, short), junit.framework.TestCase#assertEquals(char, char), junit.framework.TestCase#assertEquals(java.lang.String, char, char), junit.framework.TestCase#assertEquals(byte, byte), junit.framework.TestCase#assertEquals(java.lang.String, byte, byte), junit.framework.TestCase#assertEquals(boolean, boolean), junit.framework.TestCase#assertEquals(int, int), junit.framework.TestCase#assertEquals(java.lang.String, int, int), junit.framework.TestCase#assertEquals(short, short), junit.framework.TestCase#assertEquals(java.lang.String, float, float, float), junit.framework.TestCase#assertEquals(double, double, double), junit.framework.TestCase#assertEquals(java.lang.Object, java.lang.Object), junit.framework.TestCase#assertEquals(java.lang.String, java.lang.String), junit.framework.TestCase#assertEquals(java.lang.String, java.lang.String, java.lang.String), junit.framework.TestCase#assertEquals(java.lang.String, java.lang.Object, java.lang.Object), junit.framework.TestCase#assertEquals(java.lang.String, double, double, double), junit.framework.TestCase#assertEquals(java.lang.String, boolean, boolean), junit.framework.TestCase#assertEquals(long, long), junit.framework.TestCase#assertEquals(java.lang.String, long, long), junit.framework.TestCase#assertEquals(float, float, float), junit.framework.TestCase#runBare(), junit.framework.TestCase#assertFalse(boolean), junit.framework.TestCase#assertFalse(java.lang.String, boolean), junit.framework.TestCase#assertNull(java.lang.Object), junit.framework.TestCase#assertNull(java.lang.String, java.lang.Object), junit.framework.TestCase#assertSame(java.lang.String, java.lang.Object, java.lang.Object), junit.framework.TestCase#assertSame(java.lang.Object, java.lang.Object), junit.framework.TestCase#assertNotSame(java.lang.Object, java.lang.Object), junit.framework.TestCase#assertNotSame(java.lang.String, java.lang.Object, java.lang.Object), junit.framework.TestCase#failSame(java.lang.String), junit.framework.TestCase#failNotSame(java.lang.String, java.lang.Object, java.lang.Object), junit.framework.TestCase#failNotEquals(java.lang.String, java.lang.Object, java.lang.Object), junit.framework.TestCase#wait(long, int), junit.framework.TestCase#wait(long), junit.framework.TestCase#wait(), junit.framework.TestCase#equals(java.lang.Object), junit.framework.TestCase#hashCode(), junit.framework.TestCase#getClass(), junit.framework.TestCase#notify(), junit.framework.TestCase#notifyAll() |
Allows you to provide user input for any commands that require it. In other words, you can run commands in interactive mode. For example, you could pass "app1" as the input parameter when running the "create-app" command.
Executes a Grails command. The path to the Grails script is inserted at the front, so the first element of command should be the name of the Grails command you want to start, e.g. "help" or "run-app".
a
- list of command arguments (minus the Grails script/executable).Returns the process output as a string.
Returns the working directory for the current command. This may be the base working directory or a project.
Signals any threads waiting on condition to inform them that the process output stream has been read. Should only be used by this class (not sub-classes). It's protected so that it can be called from the reader thread closure (some strange Groovy behaviour).
Checks that the output of the current command starts with the expected header, which includes the Grails version and the location of GRAILS_HOME.
Waits for the current command to finish executing. It returns the exit code from the external process. It also dumps the process output into the "cli-tests/output" directory to aid debugging.