Wednesday, December 31, 2014

How to create test automation faster

Two of the common approaches to create test automation are Record/ Run and Scripting. But, each of these approaches has associated problems. What is a better approach to build test automation? View my video, How to create test automation faster or read on.

How to create test automation faster

Record and Playback approach
This approach is easy to use, quick and generates self-explanatory steps. However, it hard-codes the input and output test data, the test is fragile. Also, modifying the recorded test needs the recording to be repeated.

Scripting or Descriptive Programming approach
If designed well, the test automation scripts can be robust and input and output test data can be parametrized. Also, modifying the script is easier because the entire script need not be re-written; only the relevant part can be modified. However, this approach needs more skills and takes more time to create the test automation.

Since both the above approaches have problems in isolation, I decided to combine them in a recent Selenium test automation project. I call this approach the Hybrid approach.

Hybrid approach
I used the recording feature of Selenium IDE. Then, exported the Selenium IDE test case to Selenium WebDriver code. After editing the automatically generated WebDriver code, I implemented input and output test data parametrization and exception handling. Much faster than writing all the WebDriver code by hand.

Using the Hybrid approach, I was able to save time while still enjoying the benefits of Scripting or Descriptive Programming approach. If your chosen test automation tool provides recording and export to script, you should consider the hybrid approach. You can see my presentation with an example of the Hybrid approach here.

Happy testing!