Chapter 25: Swing Testing with Abbot


Overview

Abbot is the final Swing testing framework that we will discuss in this section of the book. The primary difference between Abbot and the other two (Jemmy and jfcUnit) is that Abbot provides test recording functionality and playback through Costello (get it, Abbot and Costello?). This functionality makes it easier for us to write tests for a pre-existing application by simply firing up Costello and our application and manually recording the tests. Costello also offers us the ability to edit saved test scripts as well as allowing us to separate our tests into discrete units and then aggregate them.

Another difference between Abbot and the others is that it is based off of the java.awt.Robot class ”this class was created by Sun to aid in remotely interacting with Swing applications, but is rather low level. Abbot has extended Robot and added more usable interfaces to it for Swing testing. This comes through specifically in the naming of Abbot, which stands for A better ˜bot .

Where to Get Abbot and Its Required JARs

Abbot is an open source project hosted at Sourceforge, and it is available under the Common Public License at http://abbot. sourceforge .net/.

Abbot also requires other packages which are not included in its source download:

JUnit: http://junit.org

jdom: http://jdom.org

Xerces parser: http://xml.apache.org/xerces2-j/index.html

GNU RegExp: www.cacas.org/java/gnu/regexp/ (version 1.1.0)

MRJ Toolkit: http://developer.apple.com/samplecode/Sample_Code/QuickTime/QuickTime_for_Java/MRJToolkitStubs.htm (this ZIP file is not included in either the source or ZIP distribution, so you will need to download it)

These capabilities are highlighted in the goals of Abbot:

  • Scripted control of actions and inspection: Test scripts are dynamically interpreted rather than using compiled tests, allowing users the ability to quickly edit and execute tests.

  • Loose component bindings: Rather than binding to a specific component by location, Abbot allows us to bind to the component s name . This enables users to rely on the naming convention of the component itself rather than its location, which can change over time.

  • High-level semantic actions, bound to low-level events: Abbot builds on top of the Robot class to aid in testing Swing applications by providing a wrapper around it, easing the use of the Robot class.

  • Support live recording of high-level semantic actions: Using Costello a user can easily record just about any event one would like to test for in their application.

  • Extensible user action recording and generation: The core Tester and Recorder objects are easily extended to make new ones for more extensive or custom testing.




Professional Java Tools for Extreme Programming
Professional Java Tools for Extreme Programming: Ant, XDoclet, JUnit, Cactus, and Maven (Programmer to Programmer)
ISBN: 0764556177
EAN: 2147483647
Year: 2003
Pages: 228

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net