Skip to end of banner
Go to start of banner

How to test Hello World

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

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
  • No labels