Test Automation
What is Automation?
Automation is the creation and application of technologies to produce and deliver goods and services with minimal human intervention. The implementation of automation technologies, techniques and processes improve the efficiency, reliability, and/or speed of many tasks that were previously performed by humans.
What is Test Automation?
In software testing, test automation is the use of software separate from the software being tested to control the execution of tests and the comparison of actual outcomes with predicted outcomes. Test automation can automate some repetitive but necessary tasks in a formalized testing process already in place, or perform additional testing that would be difficult to do manually. It’s primarily a quality assurance measure, but its activities involve the commitment of the entire software production team.
Benefits of Test Automation
- Speedup test execution
- Avoids human errors
- Improve efficiency of testing & cost
- Improves team morale
- Test what manually impossible
Types of Automated Testing
- Code-driven — Unit Tests
- GUI(End to End Test Automation)
- API/Service Test Automation — Restful APIs, SOAP
- Mobile Test Automation — Android, iOS, Hybrid
Tools & Technologies
Making use of the right tools for automation testing at the right time is essential to deliver a quality product at speed. These tools make sure that the benefits of automation are delivered to the fullest. Thus, automation testing tools are a vital component of the software development process.
Here is a list of top automated tools:
• Ranorex
• Selenium
• HP UFT( Unified Functional Test)
• Watir
• TestComplete
• Postman
Test Automation Frameworks
A test automation framework is an integrated system that sets the rules of automation of a specific product. This system integrates the function libraries, test data sources, object details and various reusable modules. The framework provides the basis of test automation and simplifies the automation effort.
There are six common types of test automation frameworks, each with their own architecture.
- Linear Automation Framework
- Modular Based Testing Framework
- Library Architecture Testing Framework
- Data-Driven Framework
- Keyword-Driven Framework
- Hybrid Testing Framework
Benefits of a Test Automation Framework
- Improved test efficiency
- Lower maintenance costs
- Minimal manual intervention
- Maximum test coverage
- Reusability of code
Selenium
Selenium is a suite of open source software testing automation tools used to validate web applications across different browsers and platforms. Multiple programming languages like Java, C#, Python can be used to create Selenium Test Scripts. Testing done using the Selenium testing tool is usually referred to as Selenium Testing.
Selenium can be easily deployed on platforms such as Windows, Linux, Solaris and Macintosh. Moreover, it supports OS (Operating System) for mobile applications like iOS, windows mobile and android.
Selenium Software is not just a single tool but a suite of software, each piece catering to different Selenium QA testing needs of an organization.
Why Selenium?
- Open-source, there is no licensing cost involved.
- Test scripts can be written in any of these programming languages: Java, Python, C#, PHP, Ruby, Perl & .Net
- Tests can be carried out in any of these OS: Windows, Mac or Linux
- Tests can be carried out using any browser: Mozilla Firefox, Internet Explorer, Google Chrome, Safari or Opera
- It can be integrated with tools such as TestNG & JUnit for managing test cases and generating reports
- It can be integrated with Maven, Jenkins & Docker to achieve Continuous Testing
Selenium Suite Of Tools
- Selenium Integrated Development Environment (IDE)
- Selenium Remote Control (RC)
- WebDriver
- Selenium Grid
Selenium IDE
In 2006, Shinya Kastani from Japan had donated his Selenium IDE prototype to Apache’s Selenium project. It was a Firefox plugin for faster creation of test cases.
IDE implemented a record and playback model wherein, test cases are created by recording the interactions which the user had with the web browser. These tests can then be played back any number of times. The advantage with Selenium IDE is that, tests recorded via the plugin can be exported in different programming languages like: Java, Ruby, Python etc.
This is the simplest framework in the Selenium suite and is the easiest one to learn. Because of its simplicity, Selenium IDE should only be used as a prototyping tool. To create more advanced test cases, either Selenium RC or WebDriver can be used.
Selenium RC
Selenium Core was the first tool in the Selenium project. But, Selenium Core hit a roadblock in terms of cross-domain testing because of the same-origin policy. The same-origin policy prohibits JavaScript code from accessing web elements that are hosted on a different domain compared to where the JavaScript was launched.
To overcome the same-origin policy issue, testers needed to install local copies of both Selenium Core and the webserver containing the web application being tested. This lead to the birth of Selenium RC.
Selenium RC was the flagship testing framework of the whole Selenium project for a long time. This is the first automated web testing tool that allowed users to use a programming language they prefer in order to automate UI tests for web applications against any HTTP website.
Selenium RC comprises of two parts:
- Client libraries for the preferred computer language
- A server that launches and kills browsers automatically
Selenium WebDriver
Selenium WebDriver, founded by Simon Stewart in 2006, was the first cross-platform testing framework that could control the browser from OS level. It provides a programming interface to create and execute test cases. WebDriver is an upgrade to RC because it is much faster. Unlike Selenium RC, WebDriver does not rely on JavaScript for Selenium Automation Testing. It controls the browser by directly communicating with it. Each browser has its own driver on which the application runs. The different WebDrivers are:
- Firefox Driver (Gecko Driver)
- Chrome Driver
- Internet Explorer Driver
- Opera Driver
- Safari Driver and
- HTM Unit Driver
Selenium Grid
Selenium Grid was developed by Patrick Lightbody and initially called HostedQA (initially a part of Selenium v1).This is used together with Selenium RC to run parallel tests across different machines and different browsers all at the same time. Parallel execution means running multiple tests at once.
Parallel execution is achieved with the help of Hub-Node architecture. One machine will assume the role of Hub and the others will be the Nodes. Hub controls the test scripts running on various browsers inside various operating systems. Test scripts being executed on different Nodes can be written in different programming languages.