How to test Hello World
Summary
How to test a simple groovy program that produces output.
HelloWorld.groovy
println 'Hello World'
HelloWorldTest.gant
@GrabResolver(name='atlassian', root='https://maven.atlassian.com/content/groups/public/')
@Grab(group='org.swift.tools', module='gint', version='1.4.0')
import org.swift.tools.*
includeTool << Gint
gint.initialize(this) // required
gint.setCmdGenerator('groovy', [file: 'helloWorld.groovy']) // set default cmd generator to call the script
gint.add(name: 'hello', data: 'Hello World') // confirm that Hello World is produced by the script
gint.finalizeTest() // final preparations for running tests
Output
gant -f helloWorldTest.gant
= = = = = = helloWorldTest started at Fri Feb 25 21:13:08 CST 2011 = = = = = =
[start] hello
[ending] hello
[complete] hello - 1.179 secs
[info] Successful testcases . . . . . . . . . . : 1 <<< TEST SUCCESSFUL
[info] Total testcases . . . . . . . . . . . . . : 1
[info] Elapsed run time . . . . . . . . . . . . : 3.054 secs
= = = = = = helloWorldTest completed at Fri Feb 25 21:13:09 CST 2011 = = = = = =
BUILD SUCCESSFUL
Total time: 5.53 seconds
© 2005 -2024 gint.org