Skip to content

Scary Stories and GUI Automation

I remember going camping with my cousins as I was growing up. It was great fun despite sleeping inside a musty smelling canvas tent that retained heat so well it was more like a sauna. But, my father was adamant that the old canvas tent he bought at an Army Surplus store and took 2 men and 4 boys to carry and assemble was much better then those new fangled nylon tents. Nylon ripped too easily he reasoned, but canvas will withstand anything short of a raging bear. I’m not too sure there were too many raging bears roaming the camp-grounds of Maryland, Pennsylvania, and Virginia but I was confident that even if there were I would have stood a better chance inside a canvas tent as compared to those paper thin nylon tents. To this day I remember those camping trips when I smell old canvas, or perhaps it’s dried mold spores embedded in the canvas. Whichever, it takes me back to a time of fun and fond memories.

One of the best parts of the trips were sitting around the camp fire at night listening to my uncle concocting some story intended to scare the wits out of us young boys. You know, the kind of stories about headless Confederate soldiers, or werewolves, vampires, or other such wicked creatures of the night. I think these campfire chats are remnants of man’s tribal roots where the elders tried to scare the hell out of the juvenile hominids to prevent them from wandering off at night. As we got older we realized that these stories were simply fictitious folktales; sort of like successful, value-add GUI automation projects.

Last week I had lunch with a colleague who wanted to talk to me about an automation project on his team that went horribly awry. As he started to tell me his story I thought, “Wait…I heard this tale before. I can tell this story because I’ve heard it so many times over and over again…just like those scary stories I heard around the campfire growing up.” The story goes something like this.

Our team bought a new tool, or built another framework, and taught everyone how to script “black box” test cases. They developed quite a number of automated test scripts, and of course everything was working very well. The scripts were running and managers were happy because the team had a lot of automated test scripts. But, the tests weren’t finding any bugs, so just out of curiosity the managers suggested a bug bash. And sure enough as the testers started exploring the project it didn’t take long for them to fill the database with bugs. The developers were shell shocked, and the managers couldn’t believe it! They couldn’t understand why the automated GUI tests weren’t finding any bugs? And so, in a typical knee-jerk reaction fashion, the managers immediately halted the GUI automation project and required every tester to embark on an exploratory testing adventure in search of bugs. Of course, the managers decided this approach was better than investing in more GUI automation bringing an end to another GUI automation project.

Unfortunately, unlike the scary stories my father and uncles told around the campfires, stories of failed GUI automation are often true, and usually much scarier. Why are they so scary? Because I hear these sorts of stories repeated so often. It seems that we as a discipline rely on tribal knowledge where each generation simply learns through trial and error and the folktales of our elders and thrive more on hero worship of people who are often remarkably good at finding bugs by poking and prodding hour upon hour.

Now, if you haven’t caught on already you will know that I am no big fan of GUI automation. Not because I don’t think it can be useful. In fact, I think GUI automation can provide tremendous value in some situations. But unfortunately much of the automated GUI test cases I see (especially in examples) are poorly designed, simple rudimentary script-lets. Many of these automated tests are nothing more than mindless automated sequences of events contrived because the testers have been told to automate, but are not given strategic vision (why) and little to no tactical direction (what and how).

With little or no direction or goals, or without an in-depth understanding of the system they are testing the biggest problems with GUI automation is that many testers attempt to automate

  • functional tests intended to expose computational errors in the business logic layer or in the underlying APIs
  • usability tests intended to imitate ‘me’ trying to emulate the scenarios or tasks I think the customer might do

GUI automation is probably the least effective approach for functional testing. This is not to say that GUI automation will not find functional issues in the lower logic layers. I suspect we will always find ‘functional’ bugs (e.g. boundary issues, unhandled exceptions, string parsing errors, calculation problems, etc.) while testing through the UI. But, as indicated in my previous post, well-designed software is usually built in layers and a good many of the ‘functional’ issues we find today can likely be more efficiently found through more robust unit and component (API) levels of testing.

Perhaps even more silly than trying to use GUI automation for low level functional testing is the notion of using GUI automation to emulate a ‘user’ by scripting out prescriptive sequences of actions (often with hard-coded data) that are then played over and over again. Test automation cannot and should not attempt to replicate ‘me.’ I’ve said before the purpose of automation is to provide value to me, to free up my time, to increase my efficiency, and to help me be more effective in my job; automation does not replace me. Let’s face it…we (humans) are much better at evaluating the ease of use of software and whether scenarios that represent target customer segments are intuitive for those customers.

For example, I once had a conversation explaining that GUI automation runs much faster than I can interact with software, and sometimes I make mistakes when typing in something that throws an unexpected message or takes me down a path. My colleague replied, “Well, we can slow down the automation.” Why? Why in the hell would I want to slow down my automated tests? C’mon…we all should know by now that the 100% automation (or automate all tests) mantra is a ridiculous dream and I’ve heard more plausible fantasies from people on acid trips.

So, where does GUI automation add value. In my opinion, GUI automation is probably most effective in testing UI control properties and the event handlers between the UI layer and the API layers. It is also effective in behavioral testing areas such as performance and stress.  And GUI automation is also much more effective in evaluating UI layout issues such as misaligned controls, or clipped or truncated controls on a window as compared to the human eye.

Similar to how we use different techniques to expose different categories of defects, and how we use different approaches to testing depending on the context or test objective test automation is a useful tool in our toolbox. It is certainly not the only tool. We can do some remarkable things with automation, but we must learn where GUI automation adds value and where other approaches testing (automated or manual) might be more effective.

5 Comments

  1. Good story. And scary, too!

    In my experience, your tale of “They couldn’t understand why the automated GUI tests weren’t finding any bugs?” happens just as often when the string “GUI” is omitted.

    Tests (automated, GUI, API-level, functional, usability, and otherwise) are only valuable if they are finding the bugs that exist.

    [Bj's Reply] Hi Joe, You are quite right that any automation that is poorly designed has a low probability of adding value to the testing effort or exposing any bugs that might exist. But, just like highly skilled testers, even well designed automated tests may not find all the bugs. To me the greatest value-add of test automation is that it can increase test coverage of variables much more efficiently than humans and thus reduce overall risk and increase confidence.

    Also, in my experience, another problem I have seen is that new testers will automate a test and then massage the test to make it work while completely overlooking a bug; bascially they are automating around the bug. Certainly while this can happen with any automation approach at any level, in my experience I see this more in GUI automation efforts.

    In the end I think the value (or lack thereof) of automation depends heavily on the ability of the tester to design automated tests using a variety of approaches to most effectively expose or reduce risk. Poorly designed automated tests simply adds to poor automated testing.

    Wednesday, February 17, 2010 at 2:03 PM | Permalink
  2. lixiong wrote:

    GUI Automation is much difficult to implement than API Automation. Usually the tester does not “want” to automate it, and just because managers “want” the magic numbers like automation coverage/pertentage. Because of the implementation difficulity, tester takes lot of time fighting with timming issue, unstabalitiy issue, and their only expectation is to make it work, at least seems worked. Actually, for these Scary Stories, I do not think their automation framework or scripts’ quality is good. As you said, they could not even slow down a case. I saw the same Scary Stories happening on API automation too. On the other side, they expected GUI automation to find bugs. They should design another test path for bug findings at develping stage, turn the bugs to new automation case, and expect GUI to find regression at the end stage.

    [Bj's Reply] Hi Li, Yes these same problems may occur with any type of automation; although I will say that in my experience timing issues and synchronization problems tend to be a lot less at the API level as compared to the GUI level. Automation is a wonderful tool, but in my opinion it is often misused. If we are looking for increased bug count from our automation we are likely not be be satisfied with the results. The #1 lie about test autoamtion is that it will find more bugs. (Someday I will do a post on my perspective of big automation lies.) I also agree with you that pointy-haired managers who are fixated on simple numbers also tend to lead a team towards project failure because their perspective is one-sided and often biased.

    Wednesday, February 17, 2010 at 7:05 PM | Permalink
  3. Very good article explains all the limitations of GUI automation.

    The only use of GUI automation I have found of any use is for data entry via the front end system

    [Bj's Reply] Thanks John. GUI automation can add value in other ways as well; especially in some types of behavioral or non-functional testing such as performance, stress, etc. The problem comes from trying to automate everything through the GUI. But, I suspect that if our only view of software is the UI then GUI automation is the answser to every problem…sort of like…if the only tool we have is a hammer then everything looks like a nail. :-)

    Thursday, February 18, 2010 at 1:33 AM | Permalink
  4. Verand wrote:

    Great Post!
    GUI Automation does not give us better results until we stop thinking about it as a “Quick” solution for finding more bugs. Automation(framework/tool) should be built with extreme care understanding its boundaries and it should be in par with code development.

    [Bj's Reply] Very well said.

    Monday, February 22, 2010 at 5:51 AM | Permalink
  5. chai wrote:

    Nice topic, BJ! I would like to share some notes on this topic from an ongoing application of GUI test automation, whereby I feel there are other applications of GUI test automation as well.

    We started with GUI test automation on one of our products with smoke test prep — installing the daily build, configuring the basics, saving time for a manual tester by giving him something to test further with, than having to start configuring from scratch. And of course, we test the configuration process during the automation. As we started off with automating the smoke tests first, this enabled us to address most of the features and their basic use cases. Once we had a steady base, we extended our GUI tests to address performance tests (which you mention): measuring app responsiveness and assisting automated memory leak analysis.

    Currently, we are also progressing with the automation of functional system tests that are either manually too laborious, or of lower priority but ones that still counts (because the manual tester would test the main use cases anyway), or plain better suited for automation, like some of the alignment and placement topics that you mentioned. As the app’s still fresh, there is need for weekly regression system test runs, and with limited manual tester resources, GUI test automation provides a respite by adding about 20% to the count of system tests run per week.

    In the end of the day, the key to our GUI test automation sustenance has been ensuring testability, delivering results to retain the management’s interest in continuing to support testability, and guiding and tracking the test automation team’s work just as it were a development project.

    It is very reassuring for me to read your view of GUI test automation, and those of other readers here. Look forward to more of your posts!

    [Bj's Reply] Hi Chai, great example! Thanks for sharing.

    Tuesday, March 30, 2010 at 9:54 AM | Permalink

2 Trackbacks/Pingbacks

  1. [...] I.M. Testy › Scary Stories and GUI Automation [...]

  2. [...] рассказывает страшные истории и утверждает, что автотесты графического интерфейса [...]