Posts

Showing posts from August, 2012

Using java.awt.Robot to Create User Input Events

The motivation to use java.awt.Robot class is creating mouse-keyboard input events to test applications. Testing the application just using rough mouse and key event is extremely difficult. I think, there should be a handy framework to enhance and wrap java.awt.Robot class to support such following functionality:  Taking ascii characters to map key events Soft mouse movements instead of instant mouse location changes Recording user actions to regenerate sequence of actions Appropriate xml schema to save actions into xml file windows, unix and mac native implementations to manage os specific actions that are not supported by java.awt.Robot As a kickstart, I tried to explicitly show off setAutoDelay, keyPress, keyRelase, mouseWheel, mouseMove methods usages. Comments over code blocks are covering the all following code target action. Obviously, a single tab key, costs 2 lines of code; this is too much for a single key if you are developing a great application project with hundred