Testing GUIs with Abbot and Costello
Please turn off all
Benefits of Test Driven Development are Well Known
Why test?
For Unit Testing to Work
But Testing GUIs is Hard
Different Styles of Testing
Some pieces can be tested using public APIs
But this gets old fast
We need some generic methods
Enumerating all windows
Enumerating all dialogs
Enumerating all components in a container
Finding a menu item by label
Driving the application through the event queue
java.awt.Robot
Robot API
Robot Example
Testing Pixel Colors
Testing With Screen Captures
This is still pretty low-level stuff
Questions?
Abbot
Key components
Example: IntegerTextField
Test we can enter "1" into the textfield and get the value 1 out
Now test that non-numbers are ignored
Other things ComponentTester can make a component do
ComponentLocation
Many Components don't need anything more than ComponentTester and their public APIs to test them
Testing Windows
Testing Window Resize
Testing Buttons
Testing Checkboxes
Testing Choices
Testing JLists
Testing JFileChooser
Testing ComboBoxes
Testing Sliders
Testing Spinners
Testing Split Panes
Testing Tables
Testing TextComponents
Testing Trees
Configuring Abbot's Robot:
Finding Components To Test
Matcher
Match the New PLayer menu item
Find the New Player menu item
ComponentTestFixture
Questions?
Costello
Costello Recording
Running a Saved Script
Integrating Costello Script into JUnit Test
To Learn More
Questions?
Entire Presentation as Single File
Start
|
Cafe con Leche
Copyright 2005 Elliotte Rusty Harold
Last Modified September 28, 2005