Over the next seven chapters, we will be concentrating on techniques for testing user interfaces. Our most basic tool for this is
java.awt.Robot class, introduced in JDK 1.3, allows us to generate native mouse and keyboard events in our test programs. This makes it possible for us to write automated tests for user interfaces.
Robot is a low-level class, having methods such as
keyPress(int keycode) and
mouseMove(int x, int y). In our tests, by contrast, we want to type long strings of text, click elements of lists, close windows, activate menus with mnemonics and accelerators, and do myriad other things. To bridge the gap, we have developed a wrapper class called
Cyborg, which has convenience ...