This post originated from an RSS feed registered with Agile Buzz
by Dave Churchville.
Original Post: Designing Testable User Interfaces
Feed Title: Agile Project Planning
Feed URL: http://feeds2.feedburner.com/AgileProjectPlanning
Feed Description: Thoughts on agile project planning, Extreme programming, and other software development topics
One of the biggest challenges in software development is creating graphical user interfaces that are easy to test. For small teams especially, having the ability to automate tests that interact with the GUI can save a great deal of manual testing effort.
Conventional wisdom suggests that to test a GUI application, you should test below the interface itself, and design an application that has a very thin UI shell. But how would you test even a simple Scribble application that let you draw on the screen?
One approach would be to design the application to support scripting. In effect you create a protocol for the presentation layer than can be driven by automation. This is the approach that testing tools for Web applications take, since HTTP and HTML offer a well-defined protocol for both taking actions and rendering the results.
So for our Scribble application, we need to be able to draw on the screen, and test to see if what we drew actually appears. The protocol could be as simple as a way to plot a point, and a way to test if a point on the screen is plotted. And maybe a way to save and load the image.
- Plot point x, y - Test point x, y - Save as file - Load file
With these simple primitives, we can now write automated acceptance tests for our Scribble application. We can test existing images to verify that what we know is in the file will be displayed properly in Scribble. We can draw to the edges and see if anything breaks. Most importantly, we can develop a suite of tests that can be run automatically whenever Scribble is updated in the future.
By thinking about how to design our user interfaces to be testable, we also allow them to be useful outside of their original intended purpose. Even our simple Scribble application could be controlled from a statistical package that doesn't have it's own drawing features to do some simple charting.
So make your user interfaces scriptable, and reap the benefits for testing now, and maybe something even more interesting later.