Friday, August 13, 2010

Automate in Straight Lines

Everyone's heard the adage "the shortest distance between two points is a straight line." This holds true in test automation as well. I recently spoke with someone who was struggling to get a UI automation tool to run against an application. This lady had no experience with test automation before, and the application was not "automation friendly." As such, she had spent almost an entire week struggling to get tests running.

I spoke with her on the phone for about 30 minutes, and during the course of the conversation, the intent of what she was doing came out. She was not testing the software, she was trying to populate a database with information, and this database would then be used for training purposes. She'd need to repopulate the db each time there was a class to teach. This GUI automation scenario she was trying to create would take hours to run, but she hoped she could start it on the night before a class and then have it be ready in the morning.

I asked her why she didn't just write a plain old SQL script that would populate the db, then create a backup of the database and restore it each time she needed to teach a class. There was silence on the other end of the line.

Look for the simple solutions. Databases can be written to directly, and then restored, over and over again. Webservices can be manipulated directly, methods can be called from dlls directly, the Windows Registry can be manipulated directly. If your intent is just to get data from point A to point B, do it in a straight line via script. Adding other layers of complexity (UIs, GUI tools, etc) is kind of like trying to go from New York City to Boston by way of Los Angeles.

2 comments:

  1. Nick,

    Great post, like Einstein said "Makes things as simple as possible, but not simpler"

    I was curious what you meant by "automation friendly." In your experience, what characteristics makes an app automation friendly? Is it design, is it UI layout, is it control identification or something else entirely?

    ReplyDelete
  2. Hi Matt

    When I say automation friendly, I usually mean an application whose controls are clearly identifiable by a tool, and the properties and methods of those controls are accessible. MS Office apps are typically not automation friendly, whereas apps written in .NET usually are.

    ReplyDelete