Summary
How to run an interactive GINT test as part of a Bamboo build. User will get an instant message when the interactive test runs. The response to the IM request will determine the outcome of the build (or at least this aspect of the build).
References
Steps
- Make sure you have 2 IM user ids, one for automation to send IMs from and one to receive IMs
- You will need the appropriate IM configuration that depends on your IM server - the example below users GTALK
- Make sure you have the Groovy Tasks for Bamboo installed
- Select your build -> Configuration
- Add a task - select a GINT task
- Select INLINE for script location
- Copy/paste the following script
- Save
- Run build
- a positive response (y) to the IM request will result in the test being successful
- a negative response (n) to the IM request will result in a failed test
GINT script to send an IM
@Grapes([ @GrabResolver(name='atlassian', root='https://maven.atlassian.com/content/groups/public/'), @Grab(group='org.swift.tools', module='gint', version='1.4.0'), @Grab(group='jivesoftware', module='smack', version='3.1.0'), @Grab(group='jivesoftware', module='smackx', version='3.1.0'), @GrabConfig(systemClassLoader=true), ]) import org.swift.tools.* includeTool << Gint //includeTool << Helper includeTool << ImHelper gint.initialize(this) imConfig = [ name: 'gtalk', to: gmailUser, host: 'talk.google.com', port: 5222, service: 'gmail.com', userName: gmailFromUser, // this needs to be hardcoded or specified in gint.properties userPassword: gmailFromPassword, // same as above ] gint.add( im: [ content: 'Do you approve?', timeout: -1, // wait forever successResponses: ['yes', 'y'], // or use the default responses failResponses: ['no', 'n'], // or use the default responses ], inline: {} ) gint.finalizeTest()
Results
Bamboo build log
... [start] z1 [response] y [ending] z1 [success] z1 [complete] z1 - 0.01 secs [info] Successful testcases . . . . . . . . . . : 1 <<< TEST SUCCESSFUL [info] Total testcases . . . . . . . . . . . . . : 1 [info] Elapsed run time . . . . . . . . . . . . : 15.203 secs = = = = = = XXX_IM_JOB1_13_GintTask_7102860042226958159 completed at Tue Mar 06 22:55:53 CST 2012 = = = = = = BUILD SUCCESSFUL Total time: 16.75 seconds ...