CHAPTER 1
Introduction to Test Automation
“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”
—Brian W. Kernighan
(Inventor of UNIX Operating System & Author of “The C Programming Language”)
Automation has been a productivity enhancer for humankind. With the advent of exponential growth in technology, how can we automate testing of the millions of lines of code churned every hour? This is where test automation plays a vital role – automating the testing of the automation tools to enhance the productivity of humankind. Test automation will be an essential part of the productivity growth of humanity. Without test automation, the release of quality code to production will become an activity equivalent to boiling an ocean. To do good quality product development, one should understand the importance of testing. To do rapid, efficient and productive testing, one should understand the importance of test automation. This chapter focuses on why test automation is very important. For a good test automation engineer, the fundamentals of test automation are must-have. He or she ought to know why, which, when and how test automation is essential. This chapter covers an introduction to why do we need test automation, what are the methods and tools we can leverage, when to do with test automation and how to get on with it. If a test automation engineer is thorough with these fundamentals, then the interview will be a smooth ride. This chapter describes key aspects of test automation that would be useful.
Structure
- What is automation?
- Introduction to test automation
- Benefits of test automation
- History of test automation
- Generations of test automation and evolution
- Introduction to different types of test automation
- Test automation framework
- What tests to automate
- Test automation challenges
- Test Automation Interview – Q & A
Objective
After studying this chapter, you should be able to understand some of the key interview questions to answer such as – Why test automation is important. What are the key drivers for test automation? Why should we automate at all? What are the hurdles faced whilst doing test automation? What are the tools available? What are the benefits of test automation? What are the skills needed by the test automation engineers? What is the history of test automation? What are some techniques and frameworks used for test automation? What are some of the challenges to overcome?
What is automation?
The definition of “Automation” as per Wikipedia is “Automation is the technology by which a process or procedure is performed with minimal human assistance.” Any process or an activity done by a human in a repetitive manner involving motor or cognitive functions is a candidate for automation. From time immemorial, automation propelled every industrial revolution. On the other hand, the success of the industrial revolution was automation. Mechanical automation drove the first industrial revolution, with mechanical engines improving productivity such as steam engines and the use of tools for agricultural and mining production. The automation of mobility with the invention of wheel by Sumerians helped humans to become more agile. The automation of the printing process by Gutenberg helped propel the dissemination of knowledge in a rapid manner. The invention of the steam engine by James Watt and the first industrial train (“The Rocket”) by George Stephenson helped propel the movement of goods in a faster manner during the industrial revolution of the 19th Century. Other automation processes such as telegraph, telephony helped humans communicate better and efficiently. The automation of manufacturing with the assembly line process introduced by Henry Ford for Model-T car paved way for producing good, rapid and cheaper motorcars. The use of robotics with a focus on concepts of quality management like just in time, Kanban etc., helped produce products with precision and consistency and good quality. Thus, automation of production and assembly line aided by the electricity, just in time assembly and other innovations helped the second industrial revolution. The third industrial revolution is all about automation through computer systems. The advances in electronics, identification of transistors, chips and rapid processors helped humans automate and fast track computing, thereby propelling all of the industries to leapfrog. Finally, the fourth industrial revolution is all about the use of AI, robotics and other means to automate the automation process itself. Hence, automation has been and will be critical in the evolution of humankind.
Introduction to test automation
The question then arises, how to automate the testing and verification of systems. Can we boil the ocean with millions of testers spending months to rollout a feature or a product? It will be like the 15th century. How can we change that? Automating the testing process and use of efficient testing techniques will help achieve rapid, high quality testing at a cheaper rate through continuous testing and delivery. For instance, this will be like Amazon and other technology leaders releasing code to production in a matter of seconds to minutes and not in years.
Software Test Automation is a software, code or a process built using a software or a programming language to test a software or application under test to validate tests. This helps in validating checks against expected results and actual results attained by running the automation scripts/software. Test Automation software focuses primarily on automating the repetitive, monotonous and manual tasks. Some of the advanced test automation software could fully automate validation of end-to-end process flows of a software application. Software Test Automation can be leveraged across SDLC phases – right from Unit Testing (when the code is written initially) – to production deployment (where the deployed code can be checked for working functionality). Test automation can also be carried out at various layers, such as Graphical User Layer, Application Programming Interface (API) Layer and at the database layer, to validate functionalities, interfaces to ensure the application software under development meets the requirements.
Software Test Automation has been around ever since mainframe computers became a common enterprise automation tool. Even mainframes used Restructured Extended Executor (ReXX), JCL and other tools for automation of the testing process, resulting in productivity improvements. For client-server and GUI applications (with Windows/Mac revolution), it started with a simple codeless record and playback moving towards a code-driven test automation. With the players such as Mercury (which has since become Micro Focus tool after an interim stint with HP), Segue offering leading automation tools of the time, test automation was widely pursued as a means to fast-track testing, reduce cycle times and improve product quality by delivering business value faster. All these resulted in the rapid growth of the software industry.
Benefits of test automation
Some of the benefits of test automation include reduction of time and errors, avoiding repeatability, ability to execute testing around the clock in multiple systems and platforms, and ability to test same functionality with different or multiple data set, platforms at the same time. With the advent of DevOps and continuous integration, test automation has removed the need for manual touchpoints and verifications by automating the end-to-end software processes with zero manual involvement. End-to-end software process could be a validation of a process flow enabled by a software right from the beginning of the process to the end of the process. This could be a combination of use-cases that outline the functionalities of a software application. Almost everything meaningfully automated could be run anytime and anywhere; however, many times we need to rely on a trigger such as an event-based or a database based. Test automation, when done right, along with processes such as test-driven development, model-specific language for testing and behaviour-driven testing etc., can improve the efficiency, coverage and quality of the work product quickly. Additionally, with good quality test automation, the ability to build reusable libraries and modularization of the code is another benefit that can save a lot of time and money across the board, at the module level, project level or enterprise level.
Some of the key benefits of test automation include (but not limited to):
- Cost Savings
- Cost Savings in terms of:
- Manual test effort reduction
- Removal of defects quickly
- Cost avoidance in terms of:
- Reduction in regression defects
- Removal of wastages
- Reusability
- Ability to write once and reuse multiple time through:
- Modular design
- Efficiency in configuration and clonability
- Faster time to market
- Efficient automation helps to reduce test execution time, as test cases can be run in parallel, in an unattended fashion and across platforms
- Tests can be triggered automatically without dependency on humans
- Better test coverage
- With test automation, a testing team can have a better test coverage for stability. However, important code branches, business functionalities need to automate by leveraging manual testing experts. Automation can help the skilled manual testers to focus on areas needing high business and functional knowledge on rapidly changing business-critical code branches of an application.
- Early defect finding
- Having an automated test suite for regression allows us to find defects early and fixing them as well.
- Efficient testing
- Test automation gives the testing team to run the test cycle efficiently and plan overall test strategy in the optimal manner for efficient outcomes.
- Repeatability
- It can be repeated in the same format as the automation is coded to run in the same way without the variations shown by human testers.
- Repeating, in the same manner, gives a clear view of application behaviour.
- Avoidance of manual errors
- As the test automation scripts follow a logic, manual errors, such as mistyping, clicking wrong buttons or other types of errors, can be avoided using test automation.
- Reuse of Skilled Testers
- Skilled testers can be leveraged to run high value-adding testing tasks instead of running low-risk, low-value adding, monotonous test scripts.
- Ability to run in parallel
- Test automation gives the test team with an ability to run in parallel with multiple data sets, devices and platforms.
History of test automation
To understand the history of test automation, we need to first understand some of the key progress made in terms of software testing and then in test automation. Let us study them:
- 1958 – First independent testing consultants incorporated in the PROJECT MERCURY program.
- In 1961 – Leeds and Weinberg published the first chapter on Program testing in the book “Computer Programming Fundamentals”.
- 1962 – Automatic Program Testing by IBM’s Renfe becomes the first full-fledged testing book.
- In the 1970’s, test automation picked up steam, TRW and IBM published first papers on test automation. The first seminal book on software testing was published in the early 70s – Program Test Methods.
- Even IBM Mainframe computers had automation tools such as SIMON or OLIVER that helped automate user interfaces or batch program execution. Test automation picked up steam in the most established computing systems of the time – Mainframes.
- NASA’s Johnson Space Centre built an automated tool called Automate...