Keyboard mapping support for Cacio Testing

Yesterday I hacked a little on our solution for reliable user interface testing, Cacio Test. It is an AWT/Swing toolkit implementation that renders into an offscreen buffer, thus avoiding any interaction with the computer’s desktop. Event support is driven exclusively by java.awt.Robot. One of the problems is that the Robot is very low level. Simulated keyboard input is implemented by keyPress() and keyRelease(), which take a keyCode. A key code denotes a key on a keyboard like ‘A’, ‘SHIFT’ or ‘ENTER’ and is expressed by the varios KeyEvent.VK_* constants. However, there is also a notion of higher level character input in the form of KeyEvent.KEY_TYPED events. Such events express that a character has been input, not a specific key. Often, a keyChar needs several keys to be pressed together or in sequence. This is highly locale specific. (I realized that Java has no way to determine the keyboard mapping locale. For example, my computer runs under DE but has a US keyboard. Any ideas?) For example, the @ char is typed by pressing SHIFT+2 on a US keyboard, but by AltGr+Q on a german keyboard. Yesterday evening I implemented full key -> char mappings for US and DE locales. With this change, Cacio Testing can now be used to test keyboard input interactions:


2 Responses to Keyboard mapping support for Cacio Testing

  1. Pingback: Cacio Testing Howto « Roman Kennke's Blog

  2. Pingback: The State of Java: Community, Part 2 – New Openness in the Java Community Process | Program Solution

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: