Our Agile/Automated GUI testing software - a sample script

Automated GUI Testing Software: I'm still debating on the name of my GUI testing software (I've been calling it XGT, for eXtreme GUI Testing software), and today I'm calling it Agile GUI Testing (or Agile GUI Tester). None of that matters at the moment, but after pounding away on it some more last night, I thought I'd share a sample script of how this software works.

To that end, here's a sample Agile GUI Testing software script that does the following:

  • Brings a Google Chrome window to the foreground
  • Opens the devdaily site in a window
  • Opens a new Chrome tab
  • Opens the OneMansAlaska site in that new tab

This quite possibly demonstrates the first call of an AppleScript script from JRuby, so I think that's kinda funny, and also very useful. I think it demonstrates the power of having Ruby, JRuby, and Java as a scripting language.

Automated GUI Testing software - example script

Here's the source code for my Agile GUI Testing script:

require 'java'
require 'AgileGuiTesting'

# a ruby/jruby method to bring chrome to the foreground with applescript
def fg_chrome
  cmd = "osascript -e 'tell application \"Google Chrome\"' -e 'activate' -e 'end tell'"

# 'echo' statements are shown on the command line
echo 'precondition: make sure chrome is already started'
wait 3000

# bring chrome to the foreground.

# i should use a wait_for_color or wait_for_image call here, 
# but i'm being lazy.
wait 3000

# comments are great because i use them when i unroll a stack trace
comment 'get the mouse out of the way'
move_mouse 30, 200

# you can use 'c' for comments instead of 'comment'
c 'the [Apple][L] keystroke puts focus in the url field'
apple 'l'

c 'go to the desired url'
type 'www.devdaily.com \n'

# again i'm being lazy here
wait 2000

c 'open a new tab with [Apple][t]'
apple 't'

c 'go to the OMA website; the url field automatically gains focus'
type 'www.onemansalaska.com \n'

I hope you'll agree that this GUI testing script is very easy to read. It would be about half the length if I left out all the extra comments that make it easier to read here.

Agile GUI Testing software - summary

Although this is a simple use of my Agile GUI Testing software, I think you can see that the language is very simple and clean. In addition to being simple and clean, the programming language used under the covers is JRuby, which in turn means that you have all the power of the Ruby and Java programming languages at your disposal, which I think is pretty cool.

Again, I will be release my Agile GUI Testing software later this week, so please stay tuned.

Also, many thanks to several people on the Apple java-dev mailing list, who helped me through some problems with some Java Robot code yesterday.

Update - Agile/Automated GUI testing software

Our Agile/Automated GUI testing software now has a new home page. Just follow that link for downloads and support documents for our Agile/Automated GUI Testing (AGT) software.

Add new comment

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.