Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Groovy Gosu Shell Java JavaScript
Branch: master
Failed to load latest commit information.
autostart/kitchen_sink_app fix PluginViews functional test
gradle/wrapper update test suite for latest changes to grails-core
plugins added missing plugins for plugin-views spec
src/test/groovy/grails/functional/tests switch assertions to try to get a better idea of what is failing
.gitignore fixed failing test, improved handling of auto startup apps and remove…
gradlew first cut of new geb/spock based functional test suite

Grails Functional Test Suite v2

New version of the functional test suite for Grails based on Gradle, Spock and Geb.

Tests are found within the src/test/groovy directory.

A basic test looks like:

class RunAppSpec extends BaseSpec {
    void "Test run-app starts correctly"() {
        given:"A new project"
            grails {
                createApp "test"

        when:"The home page is requested"
            go ""
        then:"The Grails welcome page is shown"
            title == "Welcome to Grails"

The above example creates a new project and tests it, deleting it on completion. To test an existing project you can instead use BaseApplicationSpec:

class RunAppSpec extends BaseApplicationSpec {
    String getApplication() { "foo" }
    void "Test run-app starts correctly"() {
        when:"The home page is requested"
            go ""
        then:"The Grails welcome page is shown"
            title == "Welcome to Grails"            

The application needs to be created in the "apps" directory of the project before this test can be run.

Tests are executed using standard Gradle test command:

./gradlew test

Running a single test can be done with:

./gradlew -Dtest.single=RunApp test

Where "RunApp" above is the test name.

By default the test suite tries to look for GRAILS_HOME in the directories ../grails-core or ../grails-master. If you prefer to tell the suite where Grails is you can do:

./gradlew -Dgrails.home=/path/to/grails test

Tests can also be run from the IDE. Just generate Eclipse or Intellij project files:

./gradlew eclipse
./gradlew idea

Import the project into your IDE and run the specs directly.

Something went wrong with that request. Please try again.