"QTP or not QTP? That is the question."

The perils of GUI automation as revealed in Shakespeare's tragedies. 

It's little understood amongst Shakespearean scholars that Hamlet's life or death soliloquy was actually prompted by an inappropriate automated test tool selection.  The consequences of his error had cast him onto a 'sea of troubles' such that he was seriously contemplating suicide as an escape from what he saw as the 'The Slings and Arrows of outrageous Fortune'.  In this blog, we consider the travails of Elizabethan GUI automators generally and specifically the issues of using GUI automation with Ye Openlinke Endure.

"My strange and self-abuse, is the initiate fear that wants hard use" (Macbeth Act 3, Scene 4)

When Macbeth finds himself being sternly criticised by Lady Macbeth over a blundering attempt to automate some routine Endure testing and configuration activities using a coordinate based GUI automation tool, he makes this confession of a propensity for self-delusion borne of inexperience.  

He is of course talking about his flawed decision to automate at the GUI level. He had been struggling for weeks, mapping the precise button clicks and text box entries required but was invariably confounded by either a synchronisation issue or the seemingly random behaviour of the GUI windows.  At times during the enterprise, he'd even doubted his own sanity as in the famous dagger scene:

"I have thee not, and yet I see thee still.  
Art thou not, fatal vision, sensible
To feeling as to sight? Or art thou but
A dagger of the mind, a false creation" (Macbeth Act 2, Scene 1)

By the time he receives news of a core code upgrade which substantially alters the product at the GUI level and necessitates a complete re-write of his automation assets his utter desperation and despair at the wasted effort is evident:

"And all our yesterdays have lighted fools
The way to dusty death" (Macbeth Act 5, Scene 5)

If only Open Components had been an option for him! The advent of this technology would have enabled him to actually go directly to those aspects he was trying to automate via the native APIs rather than via a complicating level of GUI abstraction.  SpecFlowe and Cucumbere would have also become available and enabled him to organise his test assets and smooth the rocky upgrade path. See Specflow / Endur automation.

In King Lear, Shakespeare returns to the theme of test automation and examines a world without GUI automation.  The blindness of Gloucester is of course a metaphor for dispensing with the obvious (the GUI layer) and going more directly at those components under test.

"I stumbled when I saw. Full oft ’tis seen,
Our means secure us and our mere defects
Prove our commodities" (King Lear Act 4, Scene 1)

Notice he even includes a pun about the upturn in the detection rate of bugs ('mere defects') in 'commodities' detected through API level regression testing!

As Shakespeare was well aware, there is a place for GUI automation: when it's specific GUI functionality that's under test.  However, the central theme of his tragedies is to beware using the GUI as a means of creating the pre-conditions for the real tests.

As Lear himself says:

"O, that way madness lies; let me shun that;
No more of that." (King Lear Act 3 Scene 4)