Thursday, November 29, 2007

Frankenstein - Swing Testing Tool

I am a committer on the open source project Frankenstein. Its a swing testing tool. You can go through this presentation by Vivek Prahalad. You can also watch this talk at GTAC to see more about the tool.

The tool came into existence as a necessity on one of the projects at ThoughtWorks. Vivek had done the crux of getting the tool ready. Some cool features:

1) Testing mutli-threaded Swing App without a need for explicit waits due to threading.
2) Identifying all basic components present in AWT, both for playback and recording.,
3) Ability to record and playback both in Ruby as well as Java.
4) Ability to test applets.
5) A fall back naming strategy to identify controls which aren't named appropriately.
6) Assertion API in the driver interface for Thread Safe assertions.

The most important among these which makes tests from being flaky is the implicit waits. One needs to follow a naming convention, which can be obtained from the doc, when naming their Worker Threads which carry out some operation in the background and Frankenstein monitors these threads and waits till they are done. This means there is no need for explicitly adding sleeps in your Swing test code which otherwise makes test very flaky.

One thing to keep in mind is that Frankenstein uses AWT Robot. So, one has to keep the application in focus for the components to be identified.

Currently, I am working on the ability to remotely drive Frankenstein through Java. Frankenstein takes care of bootstrapping your Swing application which means both the testing tool and the application under test will be in the same process. Sometimes, for various reasons you may want the test itself to run in a different process. This is how the Ruby Driver works by default.

If you are interested to know more about this, leave a comment here. Do visit the OpenQA forum. Vivek or I will indeed answer any queries you may have.