rdmueller
rdmueller

Reputation: 11042

How do I run test-app from within a gant script?

I would like to execute some additional script steps after each test run. So basically, I would like to create a new script in grails which

Now I wonder about how to call the test-appscript from within my script...

Upvotes: 0

Views: 1103

Answers (2)

matcauthon
matcauthon

Reputation: 2261

The common way to do that is shown in this example:

scriptEnv = "test"

includeTargets << grailsScript("_GrailsInit")
includeTargets << grailsScript("_GrailsClean")
includeTargets << grailsScript("_GrailsTest")


target(main: "Testing app (unit coverage)") {
    echo "Testing app (unit coverage)"

    argsMap << ["unit":'']
    argsMap << ["coverage":'']
    phasesToRun = ['unit']

    allTests()
}

setDefaultTarget(main)

The line grailsScript("_GrailsInit") does the trick and inlcudes the targets of the grails scripts into the own.

You can have a look at this http://grails.org/doc/latest/guide/commandLine.html#creatingGantScripts

Upvotes: 3

Michael D Johnson
Michael D Johnson

Reputation: 929

You'll need to use the execute.shell command like so:

includeTool << gant.tools.Execute

target(main: "Run script") {
    execute.shell("grails test-app functional:webtest -baseUrl=http://example.com")
    //Proceed with cleanup code here...
}

See http://gant.codehaus.org/Execute+Tool for more information.

Upvotes: 1

Related Questions