Automation Testing Interview Questions and Answers
We all make mistakes. Software development is not an exception. No matter how careful you are when writing code, there is a chance of introducing bugs in the system.
However, this cannot be used as an excuse when delivering software to customers. There should be some process in place between the development and release to ensure high quality in the software. Software testing is the process of finding bugs and errors in the software. Its goal is to give enough confidence to the stakeholders to release the software to clients.
In general, you can divide software testing into two broad categories, namely manual and automated testing.
Manual Testing: A human tester manually tests the software, performing all the actions that the real users are supposed to take.
Automated Testing: A software tool conducts the testing, programmatically executing the code under the test, providing the pre-configured inputs, and verifying the actual output with the expected result.
Both manual and automated testing have their advantages and disadvantages. A healthy software development organization uses both of these techniques to ship high-quality software.
This article provides the important questions that an interviewer may ask for a software tester position. Its primary focus is on automated testing. We have divided the questions into two categories, for beginners and for advanced.
Automation testing is a software testing strategy in which a tester programmatically runs the tests using a tool or a framework instead of manually going through the test cases and executing them one by one.
The primary goal of automated testing is to save time, effort, and money on repetitive tests that don’t change frequently.
Automation testing helps teams and organizations automate the testing efforts, in turn reducing the need for human intervention and thus achieving greater speed, reliability, and efficiency. It also helps speed up the development cycle, as the developers get quick feedback and can iterate quickly.
A test is a good candidate for automation under the following conditions.
A test automation framework makes it easy to perform automation testing for your software. Here are some components of a test automation framework.
Although test automation has its advantages, it is not practical to automate all kinds of testing. Some testing can be done only by a human tester, such as user interface testing, usability, and accessibility testing.
Exploratory testing is another type of testing where a human tester provides more value than an automated test. In exploratory testing, a tester explores the software randomly, just as an end-user would do, and tries to find the bugs or UI inconsistencies or any hidden problems that developers might have overlooked.
Automated testing is helpful for large projects involving complicated calculations and for repeatable test cases. For features that change often and rarely executed test cases, a human tester provides a bigger ROI than automation would.
A test environment is a computer or a server on which a tester tests the software. After the team builds the software, the tester installs it on this computer with all its dependencies, just like the production environment. This allows the tester to test the software in a real-world scenario.
A test environment enables the tester to create reliable test setups which are identical whenever a new version of the software is released. The test environment includes the test bed, which is the test data using which the tester will test the software. This data helps the tester to verify test cases that need a particular setup.
Typically, the test environment is an identical copy of the production environment. Having a duplicate copy allows the tester to reliably reproduce the bugs reported by the customers and provide the exact steps to the developers to fix them.
Here are some prerequisites for a good test environment:
Browser automation is the technique of programmatically launching a web application in a browser and automatically executing various actions, just as a regular user would. Browser testing gives you the speed and efficiency that would be impossible for a human tester. Protractor, Cypress, and Selenium are some of the popular tools used in-browser testing.
Some of the activities performed in browser automation are as follows:
With web applications, you don’t know in advance which browsers your users will use. Hence, it’s crucial to test the web application or the website on multiple major browsers running on different operating systems.
Cross-browser testing is a type of browser automation testing where the tester verifies if the web application will work smoothly on different browsers. Some of the popular browsers include Google Chrome, Mozilla Firefox, Internet Explorer, Safari, etc.
The goal of the cross-browser testing is to launch the application on various browsers running on different operating systems, e.g. Windows, Mac OS, Linux, etc., and verify that the application works as expected. The tester looks for the design/rendering issues, the functionality of the application, and device-specific functionality.
Though it can be typically, sophisticated tools exist that allow the testers to automate cross-browser testing. Some examples include Selenium Box, BrowserStack, Browsershots, LambdaTest, etc.
With web applications, you can’t guarantee the browsers/platforms/devices your users might use to access your software. Some users could be using Google Chrome on their Android phones, some might use Firefox on a Windows desktop machine, or others could use Safari on their Macbooks.
Cross-browser testing ensures that your web application works as expected on different versions of popular browsers on multiple platforms and devices. It ensures that the users get the same experience and features irrespective of which browser they use. It helps to reach a wide range of users, allows the users to switch browsers and devices, and still get the same user experience, increasing customer satisfaction and building a loyal user base.
Software is never done. The developers are constantly adding new features, functions, fixing bugs, and so on. There is a chance that all this new code might break the existing functionality that was working.
Users dislike using a product that is broken after they download and install a new release. They expect a consistent and reliable experience from the software, no matter which version they are using. They also expect that previously working features will keep on working and won’t break in the future.
Regression testing is a testing technique where a tester makes sure that the new features didn’t break any existing functionality. Its goal is to ensure that previously developed and tested functionality still works after adding new code. When a tester performs the regression testing automatically using testing frameworks and tools, it’s known as automated regression testing.
In automated regression testing, a tester runs the suite of regression tests after each new release of the software. If the tests pass, then the tester continues with other types of testing. However, if it fails, then there is no point in further proceeding with tests until the developers fix the broken regression tests. Hence, they also act as a time-saver for the tester and ensure quality in software before shipping it.
Here are some of the best practices a software development and the testing team should use to ensure quality software.
Martin Fowler first proposed the concept of the test automation pyramid in 2012. It’s a technique to think about how you should use different types of test automation to get the maximum value out of them.
The main idea behind the test pyramid is to have many unit tests and a few broad tests for the GUI.
GUI testing is very brittle. User interfaces are constantly changing. An enhancement to the software easily breaks up many tests, which need to be updated, causing additional work for the team. Testing the UI is slow and results in increased build times. You can perform it on a few machines on which you have the license for the GUI testing tool.
Hence, the test pyramid argues that you should have more automated unit tests than through the traditional UI-automation tests. It also has an intermediate layer of service tests that can provide many benefits of end-to-end UI tests without the complexities of dealing with the UI frameworks.
No. Automated testing is not making manual testing obsolete. Though automated tests help avoid regression issues or find problems that you are already aware of, manual exploratory testing is essential to find the bugs you don’t know about, such as incorrect requirements or implementations.
Some types of testing, such as exploratory testing, usability, and accessibility testing, need to be performed by a human tester.
Automated testing is only as good as automated tests. If bugs or problems are in the tests themselves, they will provide wrong results, giving false assurance to the stakeholders.
Good automation testing tests repeatable test cases which you can reproduce deterministically. It certainly reduces the amount of manual testing that a human tester would perform but does not eliminate it. Once a human tester discovers a bug, they can add automation tests to ensure that it’s caught automatically in the future.
As a team is supposed to be a single unit responsible for shipping a quality software system, it’s a team’s responsibility to write, execute, and manage test scripts. That means the developers and the QA should collaborate and use each others’ skills to perform automation testing effectively.
Each team has a different skill set. Some have more technical testers, some have quality-focused developers, and some have testers who came from development backgrounds and vice versa. Hence it’s not a good idea to pigeonhole automated testing to a particular department. Instead, collaboration and working together is the key to a successful automated testing strategy.
For any web application, browser automation and cross-browser testing are two critical testing activities to ensure that the software works on various browsers/devices/platforms. Selenium is a popular web automation tool that helps achieve that. It’s one of the most widely used and popular tools used in automation testing.
Advantages of Selenium:
Disadvantages of Selenium:
Selenium is not a single tool or a framework. It is a suite of tools that work with each other or in isolation to provide different types of automation testing. Here are the four major components of Selenium.
The software’s user interface is the only thing that the users see, touch and feel. They are not concerned about the backend code, database, or the frameworks you used to build the software. Building an application with broken, inconsistent, or annoying user interfaces can be enough to lose customers.
The goal of the UI testing is to ensure that the software uses a consistent user experience and no visual or graphical elements on the screen are broken. An advanced form of UI testing also ensures that the user interface is intuitive, prevents common mistakes, and doesn’t get in the way of the users getting their job done.
Typically, UI testing is performed manually by a human tester. With the advancements in the tools and frameworks in automation testing, UI testing is becoming a good candidate for automation.
Protractor is an open-source automated testing framework that allows you to perform end-to-end testing of your web applications. It’s built on top of WebDriverJS. Protractor is developed by Google and is especially used for testing Angular applications.
Protractor runs the tests against the web application by running it in real web browsers. It also interacts with the application like an end-user would, e.g. clicking buttons, links, filling forms, etc., and verifying the result with the expected outcome.
Since Protractor is based on the Selenium WebDriver, it’s easy to perform cross-browser testing. It provides a simple API compared to Selenium, so the learning curve is not too steep. Developers can quickly get familiar with it and start writing the end-to-end UI tests. You can also take snapshots and compare them using Protractor. It also allows you to run parallel test cases on different machines.
A test automation platform is a tool or a framework that makes it easy to automate software testing. It uses programs and scripts that are written by developers or testers to automate the entire process.
A test automation platform typically provides all the functionality that you would need to start with automated testing. It saves you from using a plethora of tools and makes them work with each other.
Test automation platforms primarily find their use in complex or large software projects where it’s difficult or cumbersome to perform manual testing on all the functionality provided by the software.
For a long time, Selenium has been one of the most popular test automation tools preferred by many teams. However, it is a very sophisticated tool with a steep learning curve, and it might not be suitable for all test projects. In recent years some popular alternatives have emerged, listed below.
Robot Framework is an increasingly popular, open-source automation testing framework primarily used for robotic process automation (RPA). Robotic process automation tries to emulate human actions and interactions with software. Similar to real humans, robotic automation can understand (to an extent) what is on screen, press keys and buttons, navigate to links and extract data.
The Robot Framework is written in Python and operating system agnostic. Most of the libraries in the ecosystem are also open-source. It has a modular architecture open for extension with other libraries. It defines the test data in files using a special syntax that’s specific to the framework. A test suite contains multiple such tests.
When you start the execution of the tests, the Robot Framework parses the test data and uses the keywords provided by the libraries to interact with the software. These libraries communicate with the software directly or indirectly using driver tools.
The Robot Framework runs the test from the command line. However, you can get detailed reports and logs in both XML and HTML formats. The framework has good support for standard libraries out-of-box, e.g. ArchiveLibrary, Browser Library, DataDriver Library, HttpRequestLibrary (for Java), etc.
The Robot Framework has three test library APIs.
Assuming a tester has configured the test environment and a test tool like Selenium, here are the steps I would take to automate the login functionality.
Although test automation comes with benefits such as efficient and fast, repeatable tests, there are a few risks a team should be aware of.
Similar to a software development and software testing life cycle, automation testing has its life cycle. Here are the major phases that an automation testing project goes through.
CAPTCHA stands for Completely Automated Public Turing Test to tell Computers and Humans Apart. It is a type of security measure and is also known as challenge-response authentication.
The primary goal of the CAPTCHA is to protect you from spam or denial-of-service attacks by bots/scripts by asking you to complete a simple test that is difficult for computers to follow. It proves you are human and not a computer.
A CAPTCHA challenge consists of two parts:
It’s not possible to automate the testing of CAPTCHA. That is the goal behind any good CAPTCHA strategy. By definition, a computer can’t automate it. If it could, then it’s not a good challenge that you can use in your application.
However, if you need to test an application that uses CAPTCHA, you have to work with the development team to build a workaround or a back door that allows the automated test to bypass the CAPTCHA challenge. It’s important to restrict this workaround only in the test environment and not release it to production.
All the software development rules apply when writing automated tests. Here are some of the best practices that one can apply for tests.
Here are some of the features to look for when selecting an automation tool:
Software testing is an important activity that ensures quality, giving the confidence to release the software to customers. Automation testing is a type of software testing where the tests are automated using tools, scripts, and frameworks, which improves the efficiency and speed of testing. This article explained automation testing and its importance in software development. It also explained different types of tools used in automation testing such as Selenium.
However, automation testing is only a single component of a good software testing strategy. Good old exploratory and manual testing conducted by a human tester are still crucial to shipping a quality software product. As a long-term strategy, the best way to improve the testing process is to test frequently, measure the results, gather feedback and use it to get better.