1. What is Automation Testing?
Automation Testing is the use of specialized tools and scripts to execute test cases on software applications to ensure efficient and reliable outcomes compared to manual testing.
2. Explain the advantages of Automation Testing.
Automation Testing offers benefits such as faster execution, repeatability, increased test coverage, and the ability to perform parallel testing. It also reduces the chance of human errors in testing processes.
3. What’s the difference between manual testing and automated testing?
Manual Testing | Automated Testing |
---|---|
A human executes the test cases one by one, without any software assistance. | Tests are executed by a testing tool or framework, without human assistance. |
Useful for non-repeatable tests that involve human ingenuity, participation, and domain experience. | Useful for repeatable tests where the software feature under test doesn’t change frequently. |
Good for accessibility and usability testing, as the tester can test the software from an end-user’s perspective. | Good for testing regression issues to make sure that the software didn’t break after introducing new changes. |
Can be slow and time-consuming, and subject to human errors and misjudgment. | Since it’s run by a computer, automated tests are fast and free from errors, given that we are testing the right thing. |
It’s possible to test the software in a randomized manner, also known as exploratory testing. | Exploratory testing is not possible in automated testing. |
UI problems and inconsistencies are easily spotted by a human tester. | Unless it’s programmed for that, the automated testing cannot discover and report the UI problems. |
It’s very difficult, rather impossible to test the software under extreme load to conduct performance testing. | Performance testing can be easily done with automation testing. |
The tester doesn’t need prior programming knowledge. | To write automated tests, the tester needs to have prior programming knowledge. |
4. When will you avoid automated testing?
Though automation has its advantages, it’s not a good idea to automate all of your testings. Here are some scenarios when a human tester can do a much better job of testing the software than an automated test suite.
- The software or the feature under the test changes frequently. It means you have to update your automated tests often to keep them up to date. Tests can quickly become obsolete and stop providing any value.
- Automated testing is also not suitable for exploratory testing. A human tester can explore the software in a much better way than a computer.
- Unless the automated tests are programmed or configured to look for UI issues, they can’t find any problems with the UI. It’s much efficient for a human tester to spot any UI inconsistencies or design issues.
5. Should you automate all testing?
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.
6. What is browser automation?
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:
- Navigate to the application URL and make sure it launches
- Test the various links on the web page and ensure they are not broken.
- Keep a record of the broken links on the page.
- Perform load and performance testing on your web application.
- Launch multiple instances of the browsers with different test users and ensure that concurrent actions work as expected.
7. Why do you need cross-browser testing?
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.
8. What is automated regression testing?
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.
9. What are some of the best practices in test automation?
Here are some of the best practices a software development and the testing team should use to ensure quality software.
-
Decide what to automate
- It’s not possible or practical to automate certain tests, such as usability, accessibility, exploratory testing, or non-repetitive test cases that frequently change.
-
Assign test cases based on skill and experience
- When dividing test cases, take into account the skills and experience of the tester and the complexity and severity of the feature under test.
-
Removing Uncertainty
- The whole goal of test automation is to have reliable, accurate, consistent tests that provide helpful feedback to the tester. If the tests fail due to bugs in the test itself, or it’s giving false positives, then the ROI on test automation starts decreasing.
-
Choosing the right frameworks and tools
- There are a lot of tools to perform automation testing. Picking the wrong tool for the test at hand will waste time and provide false confidence to release software that may fail in production.
-
Keeping test records in a bug database
- Using a bug database is a best practice whether a team uses test automation or not.
- Whenever new bugs are found by the automation tool or by the testers, they should be recorded in a bug tracking tool with the exact steps to reproduce the bugs and other details.
10. Is automated testing making manual testing obsolete?
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.
11. Who should be responsible for test automation? Developers or the QA?
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 other’s 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.
12. What is a test automation platform?
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.
13. What are some of the alternatives to Selenium?
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.
-
Cucumber
- It’s an open-source testing tool that allows writing tests in a simple, plain language readable by anyone on the team.
- It focuses on behavior-driven development, where the human-readable description of the functionality is used as the basis for testing.
-
Cypress
- Cypress is a free and open-source testing tool. It’s written in JavaScript and has become very popular recently because of its simplicity and advanced features that allow you to perform browser testing.
- Cypress makes it easy to write and debug unit tests, end-to-end tests, integration tests. It also supports taking snapshots and recordings to help to reproduce the bugs.
-
Robot Framework
- Robot Framework is a generic open-source automation framework. It can be used for test automation and robotic process automation (RPA).
14. What are the test library APIs provided by the Robot Framework?
The Robot Framework has three test library APIs.
- Static API: A module or a class containing methods map directly to the keyword names that take the same arguments as the implementing methods.
- Dynamic API: The names of the keywords to implement and how to implement is determined at runtime.
- Hybrid API: Combination of both the static and dynamic API. Libraries are classes containing the methods that tell them which keywords to implement, but those keywords must be available directly.
15. How will you automate the basic login in a web application?
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.
- Test the login manually to understand all the input fields, checkboxes, and buttons on the login screen. Keep a note of which pages the user is redirected to in both successful and failed logins.
- Prepare a test dataset that contains the username and password combinations. The inputs consist of varying lengths and have alphanumeric character sets.
- Develop test cases to test various paths the user might take in a real-world scenario. Note down the expected outputs for each test case.
- In the test tool, configure each test case to be manually invoked, and use the test data prepared in step 2. Record the instances where the actual output doesn’t match the expected result.
- Verify and validate the success/error messages and the redirects after each login attempt.
16. What are some risks associated with automated testing?
Although test automation comes with benefits such as efficient and fast, repeatable tests, there are a few risks a team should be aware of.
-
Negative ROI
- A team can make a considerable investment to get automation testing going. Automated tests require lots of code and expensive tools. Developers and testers spend significant time in learning and implementing automated tests.
- However, as it’s put into practice, the team might realize that the testing strategy is not providing any real value, as the software is complex with constantly changing configuration and features. They have to keep the tests constantly up-to-date.
-
Playing catch-up with the technology.
- As with any software, automation testing tools and frameworks go through constant evolution. There is a steep learning curve to the automation tools and need prior programming experience.
- Instead of picking a tool and using it well, the development/testing team spends their time learning and playing with different tools and technologies. In that case, the automation testing might not realize its original promised value.
-
Maintenance Risk
- All code has to be maintained and kept up-to-date with the changing requirements and fixing bugs. Test automation code is no exception to that.
- Instead of building new features and fixing bugs in the software, if developers and testers find themselves spending most of their time working on the automation framework, automated testing has failed.
17. How do you automate the testing of CAPTCHA?
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.
18. What are some development practices to follow when writing automated tests?
All the software development rules apply when writing automated tests. Here are some of the best practices that one can apply for tests.
-
Validating the tests will fail
- Similar to testing that software will work, it's essential to ensure the test will fail if the feature its testing doesn't meet the criteria.
- A test that never fails is worse than having no tests, as it gives a false assurance that the feature is working.
-
Don't Repeat Yourself (DRY)
- Avoiding duplication in code is crucial.
- The benefit of this strategy is that the change is isolated to a single location, preventing bugs and errors.
-
Keep Functions Small
- Since the testers who are creating automated tests are not familiar with good coding standards, it's easy to fall into the trap of creating giant functions that try to do everything.
- This quickly results in unmaintainable code that the team is afraid to touch when the requirements change, resulting in out-of-date tests that test the legacy behavior of the system.
-
Write Good Documentation
- Having well-written documentation explains not only the what, but then why is important for new team members when they try to understand the tests.
- It can also help the person who wrote the tests when they try to modify/understand the tests in the future.
19. When selecting an automation tool, what features will you look for?
Here are some of the features to look for when selecting an automation tool:
- Test Environment support,
- Ease of use,
- Debugging features,
- Testing capabilities for various elements,
- UI element identification features,
- Should allow database testing.,
- Should support multiple frameworks.
20. Code Snippet: Sample Selenium WebDriver Test
// Sample Selenium WebDriver Test in Java
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class SampleTest {
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
driver.get("https://www.example.com");
WebElement element = driver.findElement(By.name("username"));
element.sendKeys("sampleUser");
WebElement submitButton = driver.findElement(By.id("submit"));
submitButton.click();
driver.quit();
}
}