AgileGuiTesting.rb

Path: AgileGuiTesting.rb
Last Update: Fri May 28 21:16:44 -0800 2010

Required files

java   AGTPixelColorValidator   AGTKeys  

Methods

Public Instance methods

This is an alias for the "comment" method, so you can just type "c" instead of "comment".

Does a single-click at the given x/y coordinates. The "delay" is the time between the mousePress and mouseRelease method calls. The "do_animation" field lets you specify whether you want to animate the mouse movement from the current location to the new x/y coordinates, prior to the click.

Returns true if the colors are the same (well, almost the same).

The comment method lets the tester adds a comment to a stack of comments. This does nothing visible, unless a test fails, in which case the stack of comments will be printed for debugging purposes.

Simulates pressing the [Control] key in combination with the key code you pass in. For instance, on Mac OS X, this works with VK_LEFT, VK_UP, VK_RIGHT, and VK_DOWN to move through the Mac Spaces.

Specifically, this method expects an integer key code, and not a string or character. I may modify this method to let you pass in an int, string, or character in the future, though I need to look and see if this will cause problems. For instance, if you type "ctrl 9", do you really want [Ctrl][9], or do you want [Ctrl][Tab], where the ASCII value for

Tab
is 9?

As a practical matter, I don‘t use the [Ctrl] much on Mac OS X, so I haven‘t given this much thought. However, it needs to be consisten with other methods, like apple/command, alt, shift, etc. (Sorry for rambling, I‘m tired atm.)

TODO decide on this implementation

You can call this method at the end of each script to show that you script completed successfully. This is useful when you run a series of scripts, one after the other.

Perform a mouse double-click operations at the given x/y coordinates. TODO - this currently does not let the user choose a "delay" or "do_animation".

Write a string out to the console (stdout). Useful for debugging, and also for documenting pre-conditions.

A convenience method for typing an [Enter] character.

A convenience method for typing an [Escape] character.

Not really needed by the tester. This will probably become a private method.

Not really needed by a tester, this will probably become private in the future.

Gets the RGB colors at the given pixel location. Returns a Color object so you can use c.getRed, c.getGreen, c.getBlue to get the values.

Move the mouse to the given x/y coordinates. Does not use animation, and also does not click at this point. Useful when you want to move the mouse out of the way, and will likely be used later when drag and drop capabilities are added.

The same as mouse_move, but animates the mouse cursor movement by beginning at the current mouse position, and then moving smoothly to the given x/y coordinates.

TODO This method needs to become private. For the most part, a tester shouldn‘t need access to this. Characters like ’:’ can‘t be typed directly. You must use the character beneath them on the keyboard, and add in the [Shift] key. See the shift_key_hash hash for keys that can‘t be typed directly.

Not really needed by the tester. This will probably become a private method.

Not really needed by the tester. This will probably become a private method.

A convenience method for typing a [Tab] character.

TODO - REFACTOR this method Types a string of data, wherever the input focus is currently located. Usage is like this: typewww.devdaily.com\n

Type data represented by integers or bytes, such as VK_TAB, or any other VK_* character. Usage is like this: type_keys VK_TAB

Tells the system to wait, similar to the Java Thread.sleep method. Time is in milliseconds.

This method means "Wait for the given RGB color at the given x/y coordinates. If the color does not appear withing the given wait-time, exit the script (or throw an exception if the exception_mode paramter is supplied)."

specify parameters like this:

  wait_for_xycolor x, y, r, g, b, <wait-time-in-seconds>
  wait_for_xycolor x, y, r, g, b, wait-time-in-seconds, exception_mode
  wait_for_xycolor x, y, colorname, <wait-time-in-seconds>

‘exception_mode’ is a new param. set it to true if you want this method to throw an exception instead of exiting.

if ‘colorname’ is used it needs to be an array with three elements, like this:

   WIN2K_BG_COLOR = [233, 234, 235]

Very similar to the wait_for_xycolor method, except this method waits for the given color at the given x/y location to go away. Useful for situations like waiting for a dialog to go away. TODO refactor this method, as it is very similar to the previous method.

  wait_for_xycolor_to_go_away x, y, r, g, b, <wait-time-in-seconds>
  wait_for_xycolor_to_go_away x, y, r, g, b, wait-time-in-seconds, exception_mode
  wait_for_xycolor_to_go_away x, y, colorname, <wait-time-in-seconds>

This method writes the stack of comments, and will probably become a private method in the future.

[Validate]