Automation Testing

 




//////////////

Automation Testing Interview Questions For Freshers

1. What is automation testing?

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.

2. What are the types of automation testing?

There are different testing techniques, but you can not automate them all. For example, exploratory testing. Here are some testing techniques that you can automate.

  1. Unit tests: These are written by software developers and test a unit of code in isolation.
  2. Integration tests: These test how well different software components work with each other.
  3. Regression tests: Verify that the new code didn't break any existing functionality.
  4. Performance tests: Ensure that the software won't crash and perform reasonably under heavy load or stringent conditions.
  5. UI tests: Ensure that the software uses a consistent user experience and no visual or graphical elements on the screen are broken.

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. 
You can download a PDF version of Automation Testing Interview Questions.

4. When is a good time to automate a test?

A test is a good candidate for automation under the following conditions.

  • The test is repeatable.
  • The feature under the test doesn’t change its behavior frequently.
  • It’s time-consuming for a human tester.
  • The test involves complicated calculations.
  • The test ensures the previous functionality didn’t break after a new change.

5. 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.

  1. 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. 
  2. Automated testing is also not suitable for exploratory testing. A human tester can explore the software in a much better way than a computer. 
  3. 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.

6. How do you choose a tool/framework for automated testing?

To perform any automation testing, you need to rely on software tools or frameworks. There are plenty of options to choose from many alternatives.

Here are some criteria based on which one can evaluate these tools.

  • Programmable (code-based) or code-less tools. Some tools require programming skills, while some don’t, allowing a non-coder tester to create test cases with visual assistance. Depending on your team’s experience and skill-set, you should choose accordingly.
  • Commercial vs. Open Source. There’s a vast variety in the pricing of the tools based on the feature they have. Commercial tools can be expensive, but you get tech support when needed. Open-source software is free, but you have to do your research when troubleshooting the problems.
  • Ease of use. Some automated testing tools are notoriously hard to use and require extensive training before providing any value. Some are easy to use, and you can start using them out-of-box.

Some of the most popular automation tools include Selenium, Katalon Studio, UFT, TestComplete, Testim, etc., and many more. When choosing one, you should consider the testing requirements for your project, consult your team, and assess their skills, experience, and comfort with the tool.

You should also periodically assess the return on investment from the tool you choose and be prepared to switch if needed.

7. What are the different parts of a test automation framework?

A test automation framework makes it easy to perform automation testing for your software. Here are some components of a test automation framework.

  • Test Data Management
    • A big problem in automation testing is generating the test data. A good test automation framework makes it easy to build test data for the application under test.
  • Testing Libraries
    • Managing and running the automated tests is a crucial component of any automated testing strategy. A test automation framework provides libraries that make test management easy.
    • A good test automation framework provides support for unit tests, integration tests, and end-to-end tests.
  • Testing Tools
    • Includes any GUI or command-line tools that make it convenient for testers to run the set of tests repeatedly.
    • It also consists of tools that enable testing the software under high load to conduct performance testing.

8. 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.

9. What is a test environment?

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:

  1. A server with a similar configuration, including the software and the hardware to match a production environment.
  2. Sample test data with which to test the software.
  3. Test database with reasonably realistic data, it can be a copy of an actual production database.
  4. Installed software under the test.

10. 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.

11. What is cross-browser testing?

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.

12. 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.

13. 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.

14. 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.

15. What is the test automation pyramid?

Martin Fowler first proposed the concept of the test automation pyramid[1] 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.

Automation Testing Interview Questions For Experienced

16. 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.

17. 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 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.

18. What is Selenium? What are its pros and cons?

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[2] 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:

  • Open Source: It’s developed in open and has excellent community support. The software is updated regularly, ensuring significant problems and bugs are fixed, and new features are getting added constantly. 
  • Cross-Browser: Selenium allows you to run and test your web application in multiple browsers, such as Chrome, Safari, Firefox, etc. 
  • Cross-platform: You can use Selenium on Windows, Mac OS, or Linus. This allows testing the platform compatibility of your web application. 
  • Language Agnostic: You can use Selenium in your favorite programming languages, such as Java, C#, Python, Ruby, and many more.

Disadvantages of Selenium:

  • Learning Curve: One of the most common and recurring problems mentioned by new testers is that Selenium is complicated and takes a long time to learn. It requires prior programming knowledge. 
  • No support for desktop/mobile: Selenium only supports web applications. You cannot use it to test your desktop and mobile applications. 
  • No reliable tech support: As it’s open-source software, there’s no dedicated tech support that you can use in case you run into problems.
  • Complicated debugging: It’s tougher to debug Selenium programs than the other tools and frameworks.

19. What are the different components 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.

  • Selenium WebDriver
    • A collection of open-source APIs and browser-controlling code implementations that provide a concise and straightforward programming interface. 
  • Selenium Grid
    • It enables the tester to run multiple tests across different browsers, machines, and operating systems in parallel. 
  • Selenium IDE
    • Stands for the Integrated Development Environment.
    • It allows the tester to write, record, run and debug the test cases.

20. What is UI testing?

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.

21. What is Protractor?

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.

22. 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.

23. 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).

24. What is the Robot framework? Provide a brief overview of its architecture.

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.

25. 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.

26. 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.

27. 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.

28. What are the different phases in an automation testing life cycle?

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.

  • Figure out the scope of automation testing
  • Choose the correct automation frameworks and tools
  • Design a test plan + test execution strategy
  • Set up the test environment
  • Development and execution of the test cases
  • Analysis and generation of test reports

29. What is CAPTCHA?

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:

  • A randomly generated sequence of letters/numbers. These alphanumeric characters appear as distorted images and might appear behind other non-significant characters to make it difficult for a computer to parse them. 
  • A text box where the user is supposed to copy the characters. To pass the test and prove that they are human, the user types the characters in the text box.

30. 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.

31. 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.

32. 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.
///

Following are frequently asked questions in interviews for freshers as well experienced QA professionals.

1) What is Automation testing?

Automation Testing is a technique using an automation tool to write and execute tester's test scripts and cases.

The main goal of Automation Testing is to reduce the number of test cases to be run manually and not eliminate Manual Testing altogether.

2) When will you automate a test?

Automation in preferred in following cases

  • Repetitive Tasks
  • Smoke and Sanity Tests
  • Test with multiple data set
  • Regression test cases

Usually, the decision is based on the ROI (Return on Investment)

3) When will you not automate testing?

One should not automate in following cases

  • When the Application Under Test changes frequently
  • One time test cases
  • Adhoc – Random testing

4) What are the steps involved in the Automation Process?

In the automation process, steps involved are

  • Selecting the Test tool
  • Define scope of automation
  • Planning, design, and development
  • Test execution
  • Maintenance

5) What are the points that are covered while planning phase of automation?

During planning phase of automation things which must be taken in concern are

  • Selection the "right" Automation tool
  • Selection Automation Framework if any
  • List of In scope and out of scope items for automation
  • Test Environment Setup
  • Preparing Grant Chart of Project timelines for test script development & execution.
  • Identify Test Deliverables

6) In what condition we cannot use automation testing for the Agile method?

Automation testing is not useful for agile methods in following conditions

  • When Agile testing always ask for changes in requirements
  • When Exhaustive level of documentation is required in Agile
  • Only suitable for those regression tests during agile testing like continuous integration

7) What are the primary features of good automation tool?

  • Test Environment support and easy to use
  • Good debugging facility
  • Robust object identification
  • Object and Image testing abilities
  • Object identification
  • Testing of database
  • Support multiple frameworks

8) What are the types of the framework used in software automation testing?

In software automation testing four types of framework used are

  • Data-driven automation framework
  • Keyword driven automation framework
  • Modular automation framework
  • Hybrid automation framework

9) What is the scripting standard while performing automation testing?

While writing the scripts for automation, you must consider following things,

  • Uniform naming convention.
  • 3 Lines of comments for every 10 lines of code
  • Adequate indentation.
  • Robust error handling and recovery scenario
  • Use of Frameworks wherever possible

10) What are the most popular tools for automation testing?

The most popular test tool for automation testing are

  • QTP (HP UFT)
  • Rational Robot
  • Selenium

11) On what basis you can map the success of automation testing?

By following criteria, the success of automation testing can be mapped

  • Defect Detection Ratio
  • Automation execution time and time savings to release the product
  • Reduction in Labour & other costs

12) Can list out some disadvantages of manual testing?

  • Manual Software Testing requires more time and more resources.
  • Inaccuracy
  • Executing same test case repeatedly is error prone and boring.
  • It is impractical to do manual testing on very large projects and time bounded projects.

13) Tell me what you know about Selenium

Selenium is a free (open source) Test automation library. It is used to automate Web and Mobile environments. It consists of

  1. Selenium IDE (Browser Addon – Record and Playback Tool)
  2. Selenium WebDriver
  3. Selenium Grid (Distributed Testing)

Selenium supports scripting in languages like Java, C#, Python, Ruby, PHP, Perl, Javascript.

14) Tell me about QTP

QTP (Quick Test Professional) is now known as HP UFT. It is a commercial automation tool and supports a very wide range of test environments Web, Desktop, SAP, Delphi, Net, ActiveX, Flex, Java, Oracle, Mobile, PeopleSoft, PowerBuilder, Siebel, Stingray, Visual Basic amongst others.

The scripting language is VBScript. The tool gels well with HP ALM (Test Management Tool) and HP LoadRunner (Performance Testing Tool).

Salient features of QTP include Business Process Testing, keyword driven framework, XML support, robust checkpoints, test results.

15) Explain what Sikuli is?

Sikuli is a tool that uses "Visual Image Match" method to automate graphical user interface. All the web elements in Sikuli should be taken as an image and stored inside the project.

Sikuli is comprised of

  • Sikuli Script
  • Visual Scripting API for Jython
  • Sikuli IDE

Practical uses of Sikuli is that

  • It can be used to automate flash websites or objects
  • It can automate window based application and anything you see on screen without using internal API support
  • It provides simple API
  • It can be easily linked with tools like Selenium
  • Desktop application can be automated
  • Sikuli offers extensive support to automate flash objects
  • To automate desktop, it uses powerful "Visual Match" and Flash objects
  • It can work on any technology-.NET, Java,

16) Mention what is the difference between Selenium and Sikuli?

Sikuli

Selenium

  • It provides extensive support to automate flash objects
  • It has simple API
  • It uses a visual match to find elements on the screen. So, we can automate anything we see on the screen
  • It can automate the web as well as windows application
  • It cannot automate flash objects like video player, audio player,
  • It has got complicated API
  • It does not have visual match
  • It can automate only web applications



///////

39 TOP Automation Testing Interview Questions and Answers

Most Frequently asked Automation Testing Interview Questions for Beginners and Advanced level candidates:

Test automation plays a very important role in the entire software lifecycle. Most of the time when we want to prepare for an automation testing interview, we only focus on tool-specific questions. 

However, we should also consider the fact that learning and knowing the tool is just a mean and it’s not the ultimate goal.

Automation Testing Interview Questions

Thus, whenever we are preparing for an automation tester interview, we have to consider “Automation” as a whole and focus on the framework and the steps involved.

We all know that software testing is a very important part of software development. But, with the rapidly growing software development methodologies and environments, it becomes difficult to manually test everything for an application within a limited time along with cost constraints.

Thus, Automation testing is rapidly growing in the market to speed up to the development pace. This tutorial includes top interview questions on Automation testing. I have tried to cite down the short and quick questions which are very much specific to the automation as a whole and are not specific to any “tool”.

Top 39 Automation Testing Interview Questions

We have covered basic test automation questions as well as some advanced questions for intermediate to expert level candidates of up to 2 to 5 years experience.

Q #1) What is Automation?

Answer: Automation is any action that can reduce human efforts.

Q #2) What is Automation testing?

Answer: The process of using special software tools or scripts to perform testing tasks such as entering data, executing the test steps and comparing the results, etc. is known as Automation testing.

Q #3) What all things can you automate?

Answer:

  • Regression test suite
  • Smoke / Sanity test suite
  • Build deployment
  • Test data creation
  • Automating behind the GUI like testing of APIs and methods.

Q #4) When is Automation testing useful?

Answer: Automation testing is useful in the following scenarios:

a) Regression testing: In case of a bug fix or new module implementation, we have to make sure that the already implemented or unchanged functionality is not affected. In this case, we end up running the regression test case multiple times.

For Example: After each change request or bug fix, after each iteration in case of incremental development approach, etc.

b) Non-functional Testing: Testing the non-functional aspects of an application.

For Example, Load testing or performance testing, etc are very difficult for humans to track and analyze.

c) Complex calculation checks or test scenarios that are prone to human errors.

d) Repeated execution of the same tests: Sometimes, we have to run the same set of test case for a different set of data or after each build release or on multiple hardware, software or combination of both.

Automating the test cases in the above scenarios helps in achieving the speed of testing and minimizing human errors.

Q #5) How do you identify the test cases which are suitable for automation?

Answer: Identifying the appropriate test cases for automation is the most important step towards automation.

Q #6) Can you achieve 100% automation?

Answer: 100% automation would be difficult to achieve because there would be many edge test cases and some cases that are executed seldom. Automating these cases which are not executed that often will not add value to the automated suite.

Q #7) How to decide the tool that one should use for Automation testing in their projects?

Answer: In order to identify the tool for Automation testing in your project:

a) Understand your project requirements thoroughly and identify the testing scenarios that you want to automate.

b) Search for the list of tools that support your project’s requirements.

c) Identify your budget for the automation tool. Select the tools within your budget.

d) Identify if you already have skilled resources for the tools. If you don’t have the necessary skilled resources then identify the cost for training the existing resources or hiring new resources.

e) Now compare each tool for key criteria like:

  • How easy is it to develop and maintain the scripts for the tool?
  • Can a non-technical person also execute the test cases with little training?
  • Does the tool support different types of platforms like web, mobile, desktop, etc based on your project requirements?
  • Does the tool have a test reporting functionality? If not, is it easily configurable for the tool?
  • How is the tool for cross-browser support for web-based applications?
  • How many different testing types can this tool support?
  • How many languages does the tool support?

f) Once you have compared the tools, select the tool which is within your budget and support your project requirements, and gives you more advantages based on the key criteria mentioned above.

Q #8) Currently I do not have any automation in place in my project, but now I want to implement automation, what would be my steps?

Answer:

  • First, identify which type of testing/test cases you want to automate.
  • Identify the tool
  • Design the framework
  • Create utility files and environment files.
  • Start scripting
  • Identify and work on reporting.
  • Allocating time for enhancing and maintaining the scripts.

Steps required for getting Automation Testing in place for a project include:

  • Understand the advantages and disadvantages of automation testing and identify the test scenarios which are suitable for automation.
  • Select the automation tool that is best suited for automating the identified scenarios
  • Find the tool expert to help in setting up the tool and required environment for executing the test cases using the tool.
  • Train the team so that they can write scripts in the programming language that the tool supports.
  • Create the test framework or identify the already existing one that meets your requirements.
  • Write an execution plan for OS, browsers, mobile devices, etc.
  • Write programming scripts for manual test cases to convert them into automated test cases.
  • Report the test case status by using the reporting feature of the tool.
  • Maintain the scripts for ongoing changes or new features.

Q #9) How do you decide which tool you have to use?

Answer: Concluding which tool is best suitable for the project requires a lot of brainstorming and discussions.

Q #10) Once you identify the tool what would be your next steps?

Answer: Once we finalize the tool, our next step would be to design the framework.

Q #11) What is a framework?

Answer: A framework is a set of the structure of the entire automation suite. It is also a guideline, which if followed can result in a structure that is easy to maintain and enhance.

These guidelines include:

  • Coding standards
  • Handling the test data
  • Maintaining and handling the elements (object repository in QTP)
  • Handling of environment files and properties file
  • Reporting of data
  • Handling logs

Q #12) What are the attributes of a good framework?

Answer: The characteristics include:

  • Modular: The framework should be adaptable to change. Testers should be able to modify the scripts as per the environment or login information change.
  • Reusable: The commonly used methods or utilities should be written in a common file that is accessible to all the scripts.
  • Consistent: The suite should be written in a consistent format by following all the accepted coding practices.
  • Independent: The scripts should be written in such a way that they are independent of each other. In case one test fails, it should not hold back the remaining test cases (unless it is a login page)
  • Logger: It is good to have implemented the logging feature in the framework. This would help in case our scripts run for longer hours (say nightly mode), if the script fails at any point of time, having the log file will help us to detect the location along with the type of the error.
  • Reporting: It is good to have the reporting feature automatically embedded into the framework. Once the scripting is done, we can have the results and reports sent via email.
  • Integration: Automation Framework should be such that it is easy to integrate with other applications like continuous integration or triggering the automated script as soon as the build is deployed.

Q #13) Can you do without a framework?

Answer: Frameworks are guidelines and not mandatory rules, so we can do without a framework, but if we create it and follow it, enhancing and maintaining would be easy to implement.

Q #14) What are the different types of the Automation tool that you are aware of?

Answer: Open source tool like Selenium, JMeter, etc.

Paid tools like QTP, Load Runner, Ranorex, RFT, and Rational Robot.

Q #15) What generally is the structure of a framework?

Answer: Normally the structure should have – (It would differ from project to project)

  • A “src” (source) folder having the actual test scripts.
  • A”lib” (library) folder having all the libraries and common methods.
  • A “class” folder having all the class file (in-case using java).
  • A “log” folder having the log file(s).
  • A file/folder having all the web element Ids.
  • A file containing the URL, environment and login information.

Q #16) Where will you maintain information like URL, login, password?

Answer: This information should always be maintained in a separate file.

Q #17) Why do you want to keep this kind of information in a separate file and not directly in the code?

Answer: URL, Login, and passwords are the kind of fields that are used very often and these change as per the environment and authorization. In case we hardcode it into our code, we have to change it in every file which has its reference.

In case if there are more than 100 files, then it becomes very difficult to change all the 100 files and this, in turn, can lead to errors. So this kind of information is maintained in a separate file so that updating becomes easy.

Q #18) What are the different types of frameworks?

Answer: Different types of frameworks includes:

  • Keyword-driven framework
  • Data-Driven framework
  • Hybrid Framework
  • Linear Scripting

Q #19) Can you tell some good coding practices while automation?

Answer: Some of the good coding practices include:

  • Add appropriate comments.
  • Identify the reusable methods and write it in a separate file.
  • Follow the language-specific coding conventions.
  • Maintain the test data in a separate file.
  • Run your scripts regularly.

Q #20) Any kind of test which you think should not be automated?

Answer:

  • Tests that are seldom executed.
  • Exploratory testing
  • Usability testing
  • Test which is executed quickly when done manually.

Q #21) Do you think that testing can be done only at the UI level?

Answer: Today as we are moving to the Agile mode, testing is not limited to the UI layer. Early feedback is imperial for an agile project. If we concentrate only on the UI layer, we are actually waiting until the UI is developed and available to test.

Rather we can test even before the UI is actually developed. We can directly test the APIs or the methods using tools like Cucumber and FitNesse.

In this way, we are giving the feedback much early and are testing even before the UI is developed. Following this approach will help us to test only the GUI aspect of small cosmetic changes or some validations on the UI and will help the developers by giving more time to fix the bugs.

Q #22) How do you select which automation tool is best suited for you?

Answer: Selecting the automation tool depends upon various factors like:

  • The scope of the application which we want to automate.
  • Management overhead like cost and budget.
  • Time to learn and implement the tool.
  • Type of support available for the tool.
  • Limitation of the tool

Q #23) What do you think holds the testers back to do automation? Is there a way to overcome it?

Answer: The major hurdle for testers is to learn programming/coding when they want to automate. Since testers do not code, adapting to coding is a bit challenging for testers.

We can overcome it by:

  • Collaborating with developers when automating.
  • Considering that automation is the responsibility of the whole team and not only of the testers.
  • Giving a dedicated time and focus on automation.
  • Getting proper management support.

You can save these automation testing interview questions as a pdf and print for further reading.

Q #24) What is an Automation testing framework?

Answer: A framework, in general, is a set of guidelines. A set of guidelines, assumptions, concepts and coding practices for creating an execution environment in which the tests will be automated, is known as an Automation testing framework.

An automation testing framework is responsible for creating a test harness with a mechanism to connect with the application under test, take input from a file, execute the test cases and generate the reports for test execution. An automation testing framework should be independent of the application and it should be easy to use, modify or extend.

Q #25) What are the important modules of an automation testing framework?

Answer: Important modules of an Automation testing framework are:

  1. Test Assertion Tool: This tool will provide assert statements for testing the expected values in the application under test. For Example. TestNG, Junit, etc.
  2. Data Setup: Each test case needs to take the user data either from the database or from a file or embedded in the test script. Frameworks data module should take care of the data intake for test scripts and the global variables.
  3. Build Management Tool: Framework needs to be built and deployed for the use of creating test scripts.
  4. Continuous integration tool: With CICD (Continuous Integration and Continuous Development) in place, continuous integration tool is required for integrating and deploying the changes done in the framework at each iteration.
  5. Reporting tool: A reporting tool is required to generate a readable report after the test cases are executed for a better view of the steps, results, and failures.
  6. Logging tool: The logging tool in framework helps in better debugging of the error and bugs.

Q #26) Explain some Automation testing tools.

Answer: Some of the famous Automation testing tools are explained below:

(i) Selenium: Selenium is a test framework for web application automation testing. It supports multiple browsers and is OS independent. Selenium also supports various programming languages like Java, C#, PHP, Ruby, and Perl, etc.

Selenium is an open-source set of libraries which can be used to develop additional test frameworks or test scripts for testing web-based applications.

(ii) UFT: Unified Functional Testing is a licensed tool for functional testing. It provides a wide range of features like APIs, web services, etc and also supports multiple platforms like desktops, web, and mobile. UFT scripts are written in visual basic scripting language.

(iii) Appium: Appium is an open-source mobile application testing tool. It is used to automate testing on cross-platform, native, hybrid and web-based mobile applications. Appium automates any mobile application from any language with full access to APIs and DBs from the test code.

Appium is based on the client-server architecture and has evolved from selenium.

(iv) Cucumber: Cucumber is an open-source behavior-driven development tool. It is used for web-based application automation testing and supports languages like ruby, java, scala, groovy, etc. Cucumber reads executable specification written in plain text and tests the application under test for those specifications.

For cucumber to understand the scenarios in plain text, we have to follow some basic syntax rules which are known as Gherkin.

(v) TestComplete: TestComplete is a licensed automated UI testing tool to test the application across different platforms like desktops, web, mobile, etc. It provides flexibility to record a test case on one browser and run it on multiple browsers and thus supports cross browsers testing.

TestComplete has inbuilt object recognition algorithm which uniquely identifies an object and stores it in the repository.

Q #27) What are the different types of testing framework techniques?

Answer: There are four types of automation testing framework techniques.

They are:

(i) Modular Testing framework:

This framework is built on the concept of abstraction. In this framework, the tester creates scripts for each module of the application under test individually and then these scripts are combined in the hierarchical order to create large test cases.

It creates an abstraction layer between the modules, thus any modifications in test scripts for one module do not affect any other modules.

Advantages of this framework:

  • Easier maintenance and scalability of test cases.
  • Creating test cases by using already scripted modules is easier and faster.

Disadvantages:

  • Test cases have data embedded in them. Thus executing the same test script with different data is a big change at the script level.

(ii) Data-Driven Testing framework:

In the Data-driven testing framework, the input data and the expected output data corresponding to the input data is stored in a file or database and the automated script runs the same set of test steps for multiple sets of data. With this framework, we can run multiple test cases where only the input data differs and the steps of execution are the same.

Advantages:

  • Reduces the number of test scripts that are required to be executed. We execute the same script multiple times with different data.
  • Less coding for automation testing.
  • Greater flexibility for maintaining and fixing the bugs or enhancing the functionality.
  • Test data can be created even before the automated system for testing is ready.

Disadvantages:

  • Only similar test cases with the same set of execution steps can be combined for multiple sets of data. The different set of execution steps require a different test case.

(iii) Keyword-Driven Testing framework:

It is an application-independent testing framework that uses data tables and self-explanatory keywords. Keywords explain the actions to be performed on the application under test and the data table provides the input and expected output data.

Keyword-based testing is an increment to data-driven testing.

Advantages:

  • Less coding and the same script can be used for multiple sets of data.
  • Automation expertise is not required for creating a test case using the already existing keywords for actions.
  • Same keywords can be used across multiple test cases.

Disadvantages:

  • This framework is more complicated as it needs to take care of the keyword actions and also the data input.
  • Test cases get longer and complex thereby affecting the maintainability of the same.

(iv) Hybrid Testing framework:

This framework is a combination of all the above-mentioned testing frameworks ( Modular, Data-driven, and Keyword-driven).

In this framework, the test cases are developed from modular scripts by combining them in the modular testing framework. Each of the test cases uses a driver script that uses a data file as in the data-driven framework and a keyword-based action file.

Advantages:

  • Modular and easy to maintain.
  • Less coding can take care of more test cases.
  • One test case can be executed with multiple sets of data.

Disadvantages:

  • Complex to read, maintain and enhance.

Q #28) When do you prefer Manual testing over Automation testing?

Answer: We prefer manual testing over automation testing in the following cases:

  • The project is short-term and writing scripts will be time-consuming and costly when compared to manual testing.
  • Flexibility is required. Automated test cases are programmed and run in a specific way of configurations.
  • Usability testing needs to be performed.
  • Applications/module is newly developed and has no previous test cases.
  • Ad-hoc or exploratory testing needs to be performed.

Q #29) Is Automation testing in agile Methodology useful or not?

Answer: Automation testing is useful for regression, smoke or sanity testing. All these types of testing in the traditional waterfall model happen at the end of the cycle and sometimes if there are not many enhancements to the application, we might not even have to do regression testing.

Whereas, in agile methodology, every iteration requires executing the regression test case as some new functionalities is added.

Also, the regression suite itself keeps growing after each sprint as the functional test cases of the current sprint module need to be added to the regression suite for the next sprint.

Thus, Automation testing in agile methodology is very useful and helps in achieving maximum test coverage in less time of the sprint.

Q #30) List some advantages and disadvantages of Automation testing.

Answer:

Advantages:

  • Fewer human resources
  • Reusability
  • More Test Coverage in less time
  • Reliability
  • Parallel execution of test cases
  • Fast

Disadvantages:

  • Development and maintenance time is more.
  • Tool Cost
  • Skilled resources are required.
  • Environment setup
  • Test Script debugging is an issue.

Q #31) List some advantages and disadvantages of Manual testing.

Answer:

Advantages:

  • No environment setup needed.
  • Programming knowledge is not required.
  • Recommended for dynamically changing requirements.
  • Allow human observation power to detect more bugs.
  • The cost is less for short-term projects.
  • Flexibility

Disadvantages:

  • Difficult to perform complex calculations.
  • Reusability
  • Time taking
  • High risk of human errors or mistakes.
  • More human resources are required.

Q #32) Can we do Automation testing without a framework? If yes, then why do we need a framework?

Answer: Yes, We can perform automation testing even without using a framework. We can just understand the tool that we are using for automation and program the steps in the programming language that tools support.

If we automate test cases without a framework then there won’t be any consistency in the programming scripts for test cases.

A framework is required to give a set of guidelines that everyone has to follow to have maintained readability, reusability, and consistency in the test scripts. A framework also provides one common ground for reporting and logging functionality.

Q #33) How will you automate basic “login” functionality test cases for an application?

Answer: Assuming that the automation tool and framework is already in place of the test environment.

To test the basic “Login” functionality:

  • Understand the project requirement: Login functionality will have a username textbox, a password textbox, and a login button.
  • Identify the Test scenarios: For login functionality, the possible test scenarios are:
    • Blank username and password
    • Invalid username and password
    • A valid username and invalid password
    • Valid username and password
  • Prepare a Data input file with the data corresponding to each scenario.
  • Launch the tool from the program.
  • Identify the username field, password field, and the login button.
  • For each test scenario, get the data from the data file and enter into the corresponding fields. Program click on the login button after entering the data.
  • Validate the error message for negative scenarios and the success message for positive scenarios in the test script with the help of assertions.
  • Run the test suite and generate the report.

Q #34) Is Automation testing a Black box testing or White-box testing?

Answer: Automation testing is mostly a black box testing as we just program the steps that a manual tester performs for application under test without knowing the low-level design or code of the application.

Sometimes, automated test scripts need access to the database details that are used in the application under test or some more coding details and thus can be a type of white-box testing.

Thus automated testing can be both black or white box type of testing depending on the scenarios in which automation is performed.

Q #35) How many test cases have you automated per day?

Answer: Well, the number depends on the complexity of the test cases. When the complexity was limited, I was able to automate 5 to 6 test cases per day. Sometimes, I was able to automate only one test case for complex scenarios.

I have also broken down my test cases into different components like, take input, do the calculation, verify the output etc. in case of very complex scenarios and have taken 2 or more days.

Q #36) What factors determine the effectiveness of Automation testing?

Answer: Some of the factors that determine the effectiveness of automation testing are:

  • Time saved by running scripts over the manual execution of test cases.
  • Defects found
  • Test Coverage or code coverage
  • Maintenance time or development time
  • Stability of the scripts
  • Test Reusability
  • Quality of the software under test

Q #37) Which test cases can be automated?

Answer: Types of test cases which can be automated are:

(i) Smoke test cases: Smoke testing is also known as build verification testing. Smoke test cases are run every time when a new build is released to check the health of the build for acceptance to perform testing.

(ii) Regression Test Cases: Regression testing is the testing to ensure that previously developed modules are functioning as expected after a new module is added or a bug is fixed.

Regression test cases are very crucial in incremental software approach where a new functionality is added at each increment phase. In this case, regression testing is performed at each incremental phase.

(iii) Complex Calculation test cases: Test cases which involve some complex calculations to verify a field for an application fall into this category. Complex calculation results are more prone to human errors hence when automated they give accurate results.

(iv) Data-driven test cases: Test cases which have the same set of steps and run multiple times with the change of data are known as data-driven test cases. Automated testing for these kinds of test cases is quick and cost-effective.

(v) Non-functional test cases: Test cases like load tests and performance tests require a simulated environment with multiple users and multiple hardware or software combinations.

Setting up multiple environments manually is impossible for each combination or number of users. Automated tools can easily create this environment to perform non-functional testing easily.

Q #38) What are the phases in Automation testing Life Cycle?

Answer: The phases in Automation testing life Cycle include:

  1. The decision to perform automation testing.
  2. Identify and learn about the automation tool.
  3. Determine the scope of automation testing.
  4. Design and develop a test suite.
  5. Test Execution
  6. Maintenance of test scripts.

phases in Automation testing Life Cycle

Q #39) What is an Automated test script?

Answer: An automated test script is a short program that is written in a programming language to perform a set of instructions on an application under test to verify if the application is as per the requirements.

This program when run, gives the test results as pass or fail to depend on if the application is as per the expectations.

Conclusion

These are the main questions that are independent of the automation tool or programming language. Automation testing interviews also includes tool and programming language-specific questions depending upon the tool that you have worked with.

Most of the test automation interview questions are centered on the framework you develop, so it is recommended that you create and understand your test framework thoroughly. When I am interviewing, and the candidate has answered my question on the framework, I also prefer asking a language-specific question (core java in my case).

The questions start from basics of java to write the logic of some basic scenario like:

  • How would you extract a set of text from a given line?
  • How would you extract the URL?
  • In any web page, at any frame, the number of links and its content change dynamically, how would you handle it?
  • How do you handle images and flash objects?
  • How do you find a word in a line?

Answers to all these test automation interview questions are very much specific to the tool/language that you are using for automating. So before you go for the interview, brush up your programming skills.

In case you did not get a chance to create your framework and someone else has created it, then make some time to understand it thoroughly before sitting for the interview.

Some tips for automation testing interviews would be:

  • Know your tool thoroughly.
  • Learn the locator techniques used by your tool.
  • Practice programming using the language which you use for automation testing.
  • Learn your framework and its components.
  • It’s always advantageous if you have been involved in the development of your framework. So, be thorough with the modules in the framework which you have worked on.
///

Basic & Advanced Selenium WebDriver Interview Questions:

No matter you are experienced or freshers, we have covered all levels based on the requests we got from our readers. Here we have covered Selenium Interview Questions asked in companies.

1. What is Automation Testing?

Automation testing is the process of testing a software or application using an automation testing tool to find the defects. In this process, executing the test scripts and generating the results are performed automatically by automation tools. It is required when we have a huge amount of regression test cases. Some most popular tools to do automation testing are HP QTP/UFT, Selenium WebDriver, etc.,

2. What are the benefits of Automation Testing?

This is one of the common interview questions in any Automation testing job.

  1. Saves time and money. Automation testing is faster in execution.
  2. Reusability of code. Create one time and execute multiple times with less or no maintenance.
  3. Easy reporting. It generates automatic reports after test execution.
  4. Easy for compatibility testing. It enables parallel execution in the combination of different OS and browser environments.
  5. Low-cost maintenance. It is cheaper compared to manual testing in a long run.
  6. Automated testing is more reliable.
  7. Automated testing is more powerful and versatile. Automation tools allow us to integrate with Cross Browser Testing Tools, Jenkins, Github, etc.,
  8. It is mostly used for regression testing. Supports execution of repeated test cases.
  9. Minimal manual intervention. Test scripts can be run unattended.
  10. Maximum coverage. It helps to increase the test coverage.

3. What are the challenges and limitations of Selenium WebDriver?

As we all know Selenium WebDriver is a tool that automates the browser to mimic real user actions on the web. Selenium is a free open source testing tool. Some of the challenges with Selenium WebDriver are as follows

  1. We cannot test the windows application
  2. We cannot test mobile apps
  3. Limited reporting
  4. Handling dynamic Elements
  5. Handling page load
  6. Handling pop up windows
  7. Handling captcha

Read the detailed explanation on the challenges and limitations of Selenium WebDriver

4. What type of tests have you automated?

Our main focus is to automate test cases to do Regression testing, Smoke & Sanity testing. Sometimes based on the project and the test time estimation, we do focus on End to End testing.

5. How many test cases you have automated per day?

It is one of the Selenium Tricky Interview Questions.

Actually, it depends on Test case scenario complexity and length. I did automate 2-5 test scenarios per day when the complexity is limited. Sometimes just 1 or fewer test scenarios in a day when the complexity is high.

6. What is a Framework?

A framework defines a set of rules or best practices that we can follow in a systematic way to achieve the desired results. There are different types of automation frameworks and the most common ones are:

Detailed Explanation: Types of Framework

7. What type of test cases to be automated?

Types of Test Cases To Automate are

  • Data-driven test cases
  • Test cases with higher complexity
  • Test case with many database updates
  • The test execution rate is high
  • Smoke/Critical tests
  • Tests with several combinations
  • Graph test cases
  • Higher manual execution time

Read in detail explanation on types of test cases to be automated here

8. What type of test cases not to be automated?

Types of Test Cases Not To Be Automated are

  • Subjective Validation
  • New Functionalities
  • Strategic Development
  • User Experience
  • Complex Functionality
  • Quality Control
  • Low return on investment
  • Installation and setup testing

Read in detail explanation on types of test cases not to be automated here

9. What are the advantages of the Test Automation Framework?

  1. Reusability of code.
  2. Easy reporting.
  3. Low-cost maintenance.
  4. Maximum Coverage
  5. Minimal manual intervention

10. Have you created any Framework?

If you are a beginner: You can say “No, I didn’t get a chance to create a framework from the scratch. I have used the framework which is already available. My contribution is mostly in creating test cases by using the existing framework.”

If you are a beginner but have good knowledge of creating framework: You can say “Yes, I have involved in developing framework along with other automation testers in my company.”

If you are an experienced tester: You can say “I have contributed to developing framework.” or You can say “Yes, I have created a framework from the scratch. There was no automation process in my previous company. I designed the framework from the scratch.”

11. How would you explain the Selenium test automation framework in the interview?

Here we have clearly explained each component of the Framework. Check this post to learn more about how to explain the selenium test automation framework to the interviewer.

12. Why do you prefer Selenium Automation Tool?

I prefer Selenium Automation Tool because some of the benefits of Selenium to do automation testing are

  • Free and open source – It is a free open source tool. There is no need to allot budget for this tool
  • Help – Have large user base and helping communities.
  • Cross-browser compatibility It works on almost all popular browsers such as Chrome, Firefox, Internet Explorer, and Safari.
  • Cross Platform compatibility – It works on platforms such as Windows, Linux, Mac.
  • Multiple programming languages – It supports programming languages such as Java, Phyton, Perl, Php, C#, Ruby, etc.,
  • Parallel Execution – Selenium Grid supports parallel execution of Selenium Scripts.
  • Continuous Integration – We can achieve nightly execution using Jenkins.

13. What is Selenium?

Selenium is an open source (free) automated testing suite to test web applications. It supports different platforms and browsers. It has gained a lot of popularity in terms of web-based automated testing and giving a great competition to the famous commercial tool HP QTP (Quick Test Professional) AKA HP UFT (Unified Functional Testing).

Selenium is a set of different software tools. Each tool has a different approach in supporting web based automation testing.

It has four components namely,

  1. Selenium IDE (Selenium Integrated Development Environment)
  2. Selenium RC (Selenium Remote Control)
  3. Selenium WebDriver
  4. Selenium Grid

14. What is Selenium IDE?

Selenium IDE (Integrated Development Environment) is a Firefox plugin. It is the simplest framework in the Selenium Suite. It allows us to record and playback the scripts. Even though we can create scripts using Selenium IDE, we need to use Selenium RC or Selenium WebDriver to write more advanced and robust test cases.

15. What is Selenese?

Selenese is the language that is used to write test scripts in Selenium IDE.

16. Which is the only browser that supports Selenium IDE to be used?

Firefox and Chrome. However, as Selenium IDE is community-powered, regular updates and compatibility with new browser versions cannot be ensured.

Back in 2017 when it no longer worked with Firefox’s latest version, users switched to Katalon Recorder. It supports the same commands, extension scripts, data-driven testing, and advanced test reporting platform with TestOps.

Check out Best Chrome Extensions for Software Testers

17. What is Selenium RC?

Selenium RC AKA Selenium Remote control / Selenium 1. Selenium Remote Control was the main Selenium project for a long time before the WebDriver merge brought up Selenium 2. Selenium 1 is still actively supported (in maintenance mode). It relies on JavaScript for automation. It supports Java, Javascript, Ruby, PHP, Python, Perl, and C#. It supports almost every browser out there.

18. What is Selenium WebDriver?

Selenium WebDriver AKA Selenium 2 is a browser automation framework that accepts commands and sends them to a browser. It is implemented through a browser-specific driver. It controls the browser by directly communicating with it. Selenium WebDriver supports Java, C#, PHP, Python, Perl, Ruby.

Learn Selenium WebDriver Architecture

19. What is Selenium Grid?

Selenium Grid is a tool used together with Selenium RC to run tests on different machines against different browsers in parallel. That is, running multiple tests at the same time against different machines running different browsers and operating systems.

In simple words, it is used to distribute your test execution on multiple platforms and environments concurrently.

20. When do you use Selenium Grid?

Selenium Grid can be used to execute same or different test scripts on multiple platforms and browsers concurrently so as to achieve distributed test execution

21. What are the advantages of Selenium Grid?

It allows running test cases in parallel thereby saving test execution time.
It allows multi-browser testing
It allows us to execute test cases on multi-platform

22. What is a hub in Selenium Grid?

A hub is a server or a central point that controls the test executions on different machines.

23. What is a node in Selenium Grid?

Node is the machine which is attached to the hub. There can be multiple nodes in Selenium Grid.

24. What are the types of WebDriver APIs available in Selenium?

  • Firefox Driver
  • Gecko Driver
  • InternetExplorer Driver
  • Chrome Driver
  • HTMLUnit Driver
  • Opera Driver
  • Safari Driver
  • Android Driver
  • iPhone Driver
  • EventFiringWebDriver

25. Which WebDriver implementation claims to be the fastest?

The fastest implementation of WebDriver is the HTMLUnitDriver. It is because the HTMLUnitDriver does not execute tests in the browser. Starting a browser and running test cases took more time compared to running the scripts without a browser. HTMLUnitDriver took a simple HTTP request-response mechanism for test case execution.

Learn more on How To Do Headless Browser Testing using Selenium WebDriver

26. What are the Programming Languages supported by Selenium WebDiver?

  • Java
  • C#
  • Python
  • Ruby
  • Perl
  • PHP

27. Which language is not supported by selenium?

Selenium supports all major programming languages such as Java, C#, Perl, Python, Ruby, PHP, Scala and Groovy. As of today, others are not compatible.

28. What are the Operating Systems supported by Selenium WebDriver?

  • Windows
  • Linux
  • Mac OS X
  • iOS
  • Android

29. What are the testing types that can be supported by selenium?

Testing types that can be supported by Selenium are as follows:

  • Functional Testing
  • Regression Testing
  • Retesting
  • Acceptance Testing
  • End-to-End Testing
  • Smoke Testing
  • Sanity Testing
  • Responsive Testing
  • Cross Browser Testing
  • UI Testing
  • Integration Testing

30. How many parameters can selenium commands have at minimum?

There are four parameters that you have to pass in Selenium are

  • Host
  • Port Number
  • Browser
  • URL

Host: It is the parameter which we use to bind Selenium to a specific IP. Usually, we run selenium tests on our local machine so the value will be ‘localhost’. You can sepcify IP address instead of localhost.

java -jar <selenium server standalone jar name> -host <Your IP Address>

Port Number: TCP/IP port which is used to connect selenium tests to the selenium grid hub. Default port hub is 4444.
java -jar <selenium server standalone jar name> -role hub -port 4444

Make sure no other application in your system is using this port. You may face an exception like Exception in thread “main” java.net.BindException: Selenium is already running on port 4444. Or some other service is.

If this occurs you can either shutdown the other process that is using port 4444, or you can tell Selenium-Grid to use a different port for its hub. Use the -port option for changing the port used by the hub.

java -jar <selenium server standalone jar name> -role hub -port 4441

Browser: To pass the browser which has to execute our selenium scripts

URL: To pass the application URL

31. What are the Open-source Frameworks supported by Selenium WebDriver?

  • JUnit
  • TestNG

Read: TestNG Complete Tutorial

32. What are the Locators available in Selenium?

In Selenium WebDriver, there are 8 different types of locators:

  1. ID – Practical example
  2. ClassName – Practical example
  3. Name – Practical example
  4. TagName – Practical example
  5. LinkText – Practical example
  6. PartialLinkText – Practical example
  7. XPath – Practical example
  8. CSS Selector – Practical example

Click here to see the detailed post on Locators.

33. What is an XPath?

XPath is used to locate the elements. Using XPath, we could navigate through elements and attributes in an XML document to locate web elements such as textbox, button, checkbox, Image etc., in a web page.

Learn How To Write Dynamic XPath

34. When you use these locators ID, Name, XPath, Or CSS Selector?

ID & Name locators will be used when there are unique identifiers & unique names available on the web page.
CSS Selector can be used for performance and when ID & Name locators are not unique.
XPath is used when there is no preferred locators.

35. What is the difference between “/” and “//” 

Single Slash “/” – Single slash is used to create XPath with absolute path i.e. the XPath would be created to start selection from the document node/start node.

Double Slash “//” – Double slash is used to create XPath with relative path i.e. the XPath would be created to start selection from anywhere within the document.

36. What is the difference between Absolute Path and Relative Path?

Absolute XPath starts from the root node and ends with desired descendant element’s node. It starts with top HTML node and ends with input node. It starts with a single forward slash(/) as shown below.

Relative XPath starts from any node in between the HTML page to the current element’s node(last node of the element). It starts with a double forward slash(//) as shown below.

37. What is the difference between Assert and Verify in Selenium?

Assert: In simple words, if the assert condition is true then the program control will execute the next test step but if the condition is false, the execution will stop and further test step will not be executed.

Verify: In simple words, there won’t be any halt in the test execution even though the verify condition is true or false.

Read this detailed post on Assert vs Verify with practical example here detailed post check the below link.

38. What are Soft Assert and Hard Assert in Selenium?

Soft Assert: Soft Assert collects errors during @Test Soft Assert does not throw an exception when an assert fails and would continue with the next step after the assert statement.

Hard Assert: Hard Assert throws an AssertException immediately when an assert statement fails and test suite continues with next @Test

Detailed Post: Soft Assert

39. What is the difference between setSpeed () and sleep () methods?

Both sleep() and setSpeed() are used to delay the execution speed.

setSpeed(): It set up speed that will apply a delay time before every Selenium operation.

Example: setSpeed(“5000”) – It waits for 5 seconds

sleep(): It set up wait only for once when called in our Selenium script.

Example: sleep(5000) – It waits for 5 seconds

Note: setSpeed method is applicable to Selenium IDE and Selenium RC. We cannot use setSpeed in Selenium WebDriver.

40. What are the verification points available in Selenium?

In Selenium IDE, we use Selenese Verify and Assert Commands as Verification points
In Selenium WebDriver, there is no built-in features for verification points. It totally depends on our coding style. some of the Verification points are

  • To check for page title
  • To check for certain text
  • To check for certain element (text box, button, drop down, etc.)

41. How to launch a browser using Selenium WebDriver?

WebDriver is an Interface. We create an Object of a required driver class such as FirefoxDriver, ChromeDriver, InternetExplorerDriver etc.,

To launch Firefox Driver:
WebDriver driver = new FirefoxDriver();

Note: If you use geckodriver with Selenium, you must upgrade to Selenium 3.3. Here we have to set the property as follows

To launch Chrome Driver:
WebDriver driver = new ChromeDriver();

To launch Internet Explorer Driver:
WebDriver driver = new InternetExplorerDriver();

To launch Safari Driver:
WebDriver driver = new SafariDriver();

42. Is the FirefoxDriver a Class or an Interface? 

FirefoxDriver is a Java class, and it implements the WebDriver interface.

43. What is the super interface of WebDriver?

SearchContext acts as the super interface of Web Driver.

44. Explain the line of code Webdriver driver = new FirefoxDriver(); ?

WebDriver‘ is an interface and we are creating an object of type WebDriver instantiating an object of FirefoxDriver class.

Read more on why WebDriver driver = new FirefoxDriver();

45. We do create a reference variable ‘driver’ of type WebDriver as shown below. What is the purpose of doing this way?

If we create a reference variable driver of type WebDriver then we could use the same driver variable to work with any browser of our choice such as IEDriver, SafariDriver etc.,

46. What is WebElement selenium?

WebElement in Selenium represents an HTML element. It basically represents a DOM element in a HTML document.

47. What are the different exceptions you have faced in Selenium WebDriver?

Some of the exceptions I have faced in my current project are

  1. ElementNotVisibleException
  2. StaleElementReferenceException

Element Not visible Exception:

This exception will be thrown when you are trying to locate a particular element on webpage that is not currently visible eventhough it is present in the DOM. Also sometimes, if you are trying to locate an element with the xpath which associates with two or more element.

Stale Element Reference Exception:

A stale element reference exception is thrown in one of two cases, the first being more common than the second.

The two reasons for Stale element reference are

  1. The element has been deleted entirely.
  2. The element is no longer attached to the DOM.

We face this stale element reference exception when the element we are interacting is destroyed and then recreated again. When this happens the reference of the element in the DOM becomes stale. Hence we are not able to get the reference to the element.

Some other exceptions we usually face are as follows:

  • WebDriverException
  • IllegalStateException
  • TimeoutException
  • NoAlertPresentException
  • NoSuchWindowException
  • NoSuchElementException

48. How to handle STALEELEMENTREFERENCEEXCEPTION?

Before looking how to handle Stale Element Reference Exception through Page Object Model. Let’s see what is Stale Element Reference Exception first.

Stale means old, decayed, no longer fresh. Stale Element means an old element or no longer available element. Assume there is an element that is found on a web page referenced as a WebElement in WebDriver. If the DOM changes then the WebElement goes stale. If we try to interact with an element which is staled then the StaleElementReferenceException is thrown.

Here we have given solutions to handle StaleElementReferenceException in detail.

49. What are the types of waits available in Selenium WebDriver?

In Selenium we could see three types of waits such as Implicit Waits, Explicit Waits and Fluent Waits.

50. What is Implicit Wait In Selenium WebDriver?

Implicit waits tell to the WebDriver to wait for a certain amount of time before it throws an exception. Once we set the time, WebDriver will wait for the element based on the time we set before it throws an exception. The default setting is 0 (zero). We need to set some wait time to make WebDriver to wait for the required time.

Practical example

51. What is WebDriver Wait In Selenium WebDriver?

WebDriverWait is applied on a certain element with defined expected condition and time. This wait is only applied to the specified element. This wait can also throw an exception when an element is not found.

Practical example

52. What is Fluent Wait In Selenium WebDriver?

FluentWait can define the maximum amount of time to wait for a specific condition and frequency with which to check the condition before throwing an “ElementNotVisibleException” exception.

Practical example

53. What happen if you mix both implicit wait and explicit wait in a Selenium Script?

As per the official Selenium documentation, it is suggested not to mix both Implicit waits and Explicit Waits. Mixing both of them can cause unpredictable wait times.

Implicit wait is defined only once in the code. It will remain same throughout the driver object instance.

Explicit wait is defined whenever it is necessary in the code. This wait will call at the time of execution. It is a conditional wait.

Explicit wait will overwrite the implicit wait where ever explicit wait is applied. So, Explicit Wait gets first preference then Implicit Wait.

54. What happen if you mix both Thread.Sleep and WebDriver Waits in a Selenium Script?

Thread.sleep() method can be used to pause the execution for specified time in milliseconds

If we use WebDriver waits along with Thread.sleep() method then webdriver will hold the execution for specified time and then will follow other wait. Test execution time will become more, if we mix both waits.

55. How to Login into any site if it is showing an Authentication Pop-Up for Username and Password?

To do this we pass username and password with the URL

56. How to input text in the text box using Selenium WebDriver?

By using sendKeys() method

57. How to input text in the text box without calling the sendKeys()?

Learn JavaScriptExecutor in Selenium with Examples

58. How to clear the text in the text box using Selenium WebDriver?

By using clear() method

59. How to get a text of a web element?

By using getText() method

60. How to get an attribute value using Selenium WebDriver?

By using getAttribute(value);

It returns the value of the attribute passed as a parameter.

HTML:

Selenium Code:

61. How to click on a hyperlink using Selenium WebDriver?

We use click() method in Selenium to click on the hyperlink

62. How to submit a form using Selenium WebDriver?

We use “submit” method on element to submit a form

Alternatively, you can use click method on the element which does form submission

63. How to press ENTER key on text box In Selenium WebDriver?

To press ENTER key using Selenium WebDriver, We need to use Selenium Enum Keys with its constant ENTER.

64. How to pause a test execution for 5 seconds at a specific point?

By using java.lang.Thread.sleep(long milliseconds) method we could pause the execution for a specific time. To pause 5 seconds, we need to pass parameter as 5000 (5 seconds)

65. Is Selenium Server needed to run Selenium WebDriver Scripts?

When we are distributing our Selenium WebDriver scripts to execute using Selenium Grid, we need to use Selenium Server.

66. What happens if I run this command. driver.get(“www.softwaretestingmaterial.com”) ;

If the URL doesn’t contain http or https prefix then an exception is thrown. So, we need to pass HTTP protocol within driver.get() method.

67. What is the alternative to driver.get() method to open an URL using Selenium WebDriver?

Alternative method to driver.get(“url”) method is driver.navigate.to(“url”)

68. What is the difference between driver.get() and driver.navigate.to(“url”)?

driver.get(): To open an URL and it will wait till the whole page gets loaded
driver.navigate.to()To navigate to an URL and It will not wait till the whole page gets loaded

69. Can I navigate back and forth in a browser in Selenium WebDriver?

We use Navigate interface to do navigate back and forth in a browser. It has methods to move back, forward as well as to refresh a page.

driver.navigate().forward(); – to navigate to the next web page with reference to the browser’s history
driver.navigate().back(); – takes back to the previous webpage with reference to the browser’s history
driver.navigate().refresh(); – to refresh the current web page thereby reloading all the web elements
driver.navigate().to(“url”); – to launch a new web browser window and navigate to the specified URL

70. What are the different types of navigation commands?

Refer above question (Can I navigate back and forth in a browser)

71. How to fetch the current page URL in Selenium?

To fetch the current page URL, we use getCurrentURL()

72. How can we maximize browser window in Selenium?

To maximize browser window in selenium we use maximize() method. This method maximizes the current window if it is not already maximized

73. How to delete cookies in Selenium?

To delete cookies we use deleteAllCookies() method

74. What are the ways to refresh a browser using Selenium WebDriver?

There are multiple ways to refresh a page in selenium

  • Using driver.navigate().refresh() command as mentioned in the question 45
  • Using driver.get(“URL”) on the current URL or using driver.getCurrentUrl()
  • Using driver.navigate().to(“URL”) on the current URL or driver.navigate().to(driver.getCurrentUrl());
  • Using sendKeys(Keys.F5) on any textbox on the webpage

75. What is the difference between driver.getWindowHandle() and driver.getWindowHandles() in Selenium WebDriver?

driver.getWindowHandle() – It returns a handle of the current page (a unique identifier)
driver.getWindowHandles() – It returns a set of handles of the all the pages available.

76. What is the difference between driver.close() and driver.quit() methods?

Purpose of these two methods (driver.close and driver.quit) is almost same. Both allow us to close a browser but still, there is a difference.

driver.close(): To close current WebDriver instance
driver.quit(): To close all the opened WebDriver instances

77. What is the difference between driver.findElement() and driver.findElements() commands?

The difference between driver.findElement() and driver.findElements() commands is-

  • findElement() returns a single WebElement (found first) based on the locator passed as parameter. Whereas findElements() returns a list of WebElements, all satisfying the locator value passed.
  • Syntax of findElement()-
    WebElement textbox = driver.findElement(By.id(“textBoxLocator”));
    Syntax of findElements()-
    List <WebElement> elements = element.findElements(By.id(“value”));
  • Another difference between the two is- if no element is found then findElement() throws NoSuchElementException whereas findElements() returns a list of 0 elements.

78. What Is The Difference Between MaxSessions Vs. MaxInstances Properties in Selenium Grid?

MaxInstances is the no. of browser instances of the same version of the browser that can run on the remote machine.

Let’s see an example below:

As per the above example, it will allow us to run 4 instances of both IE and Firefox at the same time (in parallel) in a remote machine.

MaxSession says how many browsers, independent of the type & version, can run in parallel on the remote machine.

It supersedes the “MaxInstances” setting.

If maxSession=1 then no more than a single browser would run. If maxSession=2 then any of the below combinations can run at a time irrespective of what MaxInstances we have defined.
2 Internet Explorer
2 Firefox
1 Internet Explorer + 1 Firefox

79. How to find whether an element is displayed on the web page? 

WebDriver facilitates the user with the following methods to check the visibility of the web elements. These web elements can be buttons, drop boxes, checkboxes, radio buttons, labels etc.

  1. isDisplayed()
  2. isSelected()
  3. isEnabled()

80. How to select a value in a dropdown?

By using Select class

Practical Example:

81. How to capture Screenshot in Selenium WebDriver?

Test cases may fail while executing the test scripts. While we are executing the test cases manually we just take a screenshot and place in a result repository. The same can be done by using Selenium WebDriver.

Some of the scenarios we may need to capture a screenshot using Selenium WebDriver are

i. Application issues
ii. Assertion Failure
iii. Difficulty to find Webelements on the web page
iv. Timeout to find Webelements on the web page

Selenium provides an interface called TakesScreenshot which has a method getScreenShotAs which can be used to take a screenshot of the application under test.

In Selenium 3, we may face few issues while capturing Screenshots. To overcome we use aShot utility. Click on below links to see posts related to the normal way of capturing a screenshot and capturing a screenshot using aShot utility.

Capture screenshot using Selenium WebDriver

Full Page Screenshot using aShot utility

Failed Test Cases Screenshot

82. How to mouse hover on a web element using WebDriver?

By using Actions class

Practical Example.

83. How can we handle Web-based Pop-ups or Alerts in Selenium?

To handle Web-based alerts or popups, we need to do switch to the alert window and call Selenium WebDriver Alert API methods.

dismiss(): To click on Cancel button.
accept(): To Click on OK button.
getText(): To get the text which is present on the Alert.
sendKeys(): To enter the text into the alert box.

Practical Example.

84. How can we handle windows based pop up?

Selenium doesn’t support windows based applications. It is an automation testing tool which supports only web application testing. We could handle windows based popups in Selenium using some third party tools such as AutoIT, Robot class etc.

85. How to handle hidden elements in Selenium WebDriver?

We can handle hidden elements by using javaScript executor

86. How can you find Broken Links in a page using Selenium WebDriver?

Practical Example.

87. How to find more than one web element in the list?

88. How to read a JavaScript variable in Selenium WebDriver?

By using JavascriptExecutor

89. What is JavaScriptExecutor and in which cases JavaScriptExecutor will help in Selenium automation?

In general, we click on an element using click() method in Selenium.

For example:

Sometimes web controls don’t react well against selenium commands and we may face issues with the above statement (click()). To overcome such kind of situation, we use JavaScriptExecutor interface.

It provides a mechanism to execute Javascript through Selenium driver. It provides “executescript” & “executeAsyncScript” methods, to run JavaScript in the context of the currently selected frame or window.

There is no need to write a separate script to execute JavaScript within the browser using Selenium WebDriver script. Just we use predefined interface named ‘Java Script Executor’. We need to import the JavascriptExecutor package in the script.

Package:

Syntax:

Script – The JavaScript to execute
Arguments – The arguments to the script(Optional). May be empty.
Returns – One of Boolean, Long, String, List, WebElement, or null.

Let’s see some scenarios we could handle using this Interface:

1. To type Text in Selenium WebDriver without using sendKeys() method
2. To click a Button in Selenium WebDriver using JavaScript
3. To handle Checkbox
4. To generate Alert Pop window in selenium
5. To refresh browser window using Javascript
6. To get innertext of the entire webpage in Selenium
7. To get the Title of our webpage
8. To get the domain
9. To get the URL of a webpage
10. To perform Scroll on an application using  Selenium
11. To click on a SubMenu which is only visible on mouse hover on Menu
12. To navigate to different page using Javascript

90. How do you read test data from excels?

Test data can efficiently be read from excel using JXL or POI API. POI API has many advantages than JXL.
Click here to see a practical example of using Apache POI.

91. Is it possible to automate the captcha using Selenium?

No, It’s not possible to automate captcha and bar code reader.

92. Can You Use Selenium For Rest API Testing Or Web Services Testing?

Simple answer for this is Selenium is not a tool for API Testing. It automates web browsers. Rest API & Web Services contains no UI. So we cannot automate using Selenium.

Don’t miss: API Testing Interview Questions

93. How to handle Ajax calls in Selenium WebDriver?

Handling AJAX calls is one of the common issues when using Selenium WebDriver. We wouldn’t know when the AJAX call would get completed and the page has been updated. In this post, we see how to handle AJAX calls using Selenium.

AJAX stands for Asynchronous JavaScript and XML. AJAX allows the web page to retrieve small amounts of data from the server without reloading the entire page. AJAX sends HTTP requests from the client to server and then process the server’s response without reloading the entire page. To handle AJAX controls, wait commands may not work. It’s just because the actual page is not going to refresh.

When you click on a submit button, the required information may appear on the web page without refreshing the browser. Sometimes it may load in a second and sometimes it may take longer. We have no control over loading time. The best approach to handle this kind of situations in selenium is to use dynamic waits (i.e. WebDriverWait in combination with ExpectedCondition)

Some of the methods which are available are as follows:

1. titleIs() – The expected condition waits for a page with a specific title.

2. elementToBeClickable() – The expected condition waits for an element to be clickable i.e. it should be present/displayed/visible on the screen as well as enabled.

3. alertIsPresent() – The expected condition waits for an alert box to appear.

4. textToBePresentInElement() – The expected condition waits for an element having a certain string pattern.

94. List some scenarios which we cannot automate using Selenium WebDriver?

1. Bitmap comparison is not possible using Selenium WebDriver
2. Automating Captcha is not possible using Selenium WebDriver
3. We can not read bar code using Selenium WebDriver

95. What is Object Repository in Selenium WebDriver?

Object Repository is used to store element locator values in a centralized location instead of hard coding them within the scripts. We do create a property file (.properties) to store all the element locators and these property files act as an object repository in Selenium WebDriver.

96. How you build Object Repository in your project?

In QTP, there is an Object Repository concept. When a user records a test, the objects and its properties are captured by default in an Object Repository. QTP uses this Object Repository to play back the scripts. Coming to Selenium, there is no default Object Repository concept. It doesn’t mean that there is no Object Repository in Selenium. Even though there is no default one still we could create our own. In Selenium, we call objects as locators (such as ID, Name, Class Name, Tag Name, Link Text, Partial Link Text, XPath, and CSS). Object repository is a collection of objects. One of the ways to create Object Repository is to place all the locators in a separate file (i.e., properties file). But the best way is to use Page Object Model. In the Page Object Model Design Pattern, each web page is represented as a class. All the objects related to a particular page of a web application are stored in a class.

97. What is Page Object Model in Selenium?

Page Object Model is a Design Pattern which has become popular in Selenium Test Automation. It is widely used design pattern in Selenium for enhancing test maintenance and reducing code duplication. Page object model (POM) can be used in any kind of framework such as modular, data-driven, keyword driven, hybrid framework etc.  A page object is an object-oriented class that serves as an interface to a page of your Application Under Test(AUT). The tests then use the methods of this page object class whenever they need to interact with the User Interface (UI) of that page. The benefit is that if the UI changes for the page, the tests themselves don’t need to change, only the code within the page object needs to change. Subsequently, all changes to support that new UI is located in one place.

98. What is Page Factory? 

We have seen that ‘Page Object Model’ is a way of representing an application in a test framework. For every ‘page’ in the application, we create a Page Object to reference the ‘page’ whereas a ‘Page Factory’ is one way of implementing the ‘Page Object Model’.

99. What is the difference between Page Object Model (POM) and Page Factory?

Page Object is a class that represents a web page and hold the functionality and members.
Page Factory is a way to initialize the web elements you want to interact with within the page object when you create an instance of it.

100. What are the advantages of Page Object Model Framework?

Code reusability – We could achieve code reusability by writing the code once and use it in different tests.

Code maintainability – There is a clean separation between test code and page specific code such as locators and layout which becomes very easy to maintain code. Code changes only on Page Object Classes when a UI change occurs. It enhances test maintenance and reduces code duplication.

Object Repository – Each page will be defined as a java class. All the fields in the page will be defined in an interface as members. The class will then implement the interface.

Readability – Improves readability due to clean separation between test code and page specific code

101. How can you use the Recovery Scenario in Selenium WebDriver?

By using “Try Catch Block” within Selenium WebDriver Java tests.

102. How to Upload a file in Selenium WebDriver?

There are two cases which are majorly used to upload a file in Selenium WebDriver such as using SendKeys Method and using AutoIT Script.

Practical Example.

103. How to Download a file in Selenium WebDriver?

By using AutoIT script, we could download a file in Selenium WebDriver.

Practical Example

104. How to run Selenium WebDriver Test from the command line?

Run Java Program using Command Prompt

Run TestNG using Command Prompt

105. How to switch between frames in Selenium?

By using the following code, we could switch between frames.

106. How to connect a Database in selenium?

As we all know Selenium WebDriver is a tool to automate User Interface. We could only interact with Browser using Selenium WebDriver.

We use JDBC Driver to connect the Database in Selenium (While using Java Programming Language).

Practical Example

107. How To Resize Browser Window Using Selenium WebDriver?

To resize the browser window to particular dimensions, we use ‘Dimension’ class to resize the browser window.

Practical Example

108. How To Scroll Web Page Down Or UP Using Selenium WebDriver?

JavaScript scrollBy() method scrolls the document by the specified number of pixels.

Practical Example

109. How To Perform Right Click Action (Context Click) In Selenium WebDriver?

We use Actions class in Selenium WebDriver to do Right-Click (Context Click) action.

Practical Example

110. How To Perform Double Click Action In Selenium WebDriver?

We use Actions class to do Double click action in selenium.

Practical Example

111. How To Perform Drag And Drop Action in Selenium WebDriver?

In some applications, we may face a situation to automate drag and drop an item from one location to another location. We could not achieve these using basic elements. Selenium has provided an “Actions” class to handle this kind of scenarios. We overcome this kind of scenarios such as drag and drop using Actions Class.

To achieve this, we use Actions class in Selenium WebDriver.

Practical Example

112. How To Highlight Element Using Selenium WebDriver?

By using JavascriptExecutor interface, we could highlight the specified element

Practical Example

113. Have you used any crossbrowsertesting tool to run selenium scripts on cloud?

I have used BrowserStack to run selenium tests on multiple browsers & Multiple operating systems in parallel. Earlier we have made a video on how to use BrowserStack to run selenium scripts on the cloud. Find the link in the description below.

114. What is desired capabilities?

In Selenium we use desired capabilities to handle SSL certificates in chrome browser

We need to create an instance of DesiredCapabilities

115. What is Continuous Integration?

Continuous Integration is abbreviated as CI. Continuous Integration is a development practice that aims to make sure the correctness of software. After each commit, a suite of tests run automatically and test the software to ensure whether the software is running without any breaks. If any test fails, we will get immediate feedback say “build is broken”.

In simple words, continuous integration is a process of verifying the correctness of a software.

Some of the continuous integration tools are Jenkins, TeamCity, Bamboo, Travis, Circle Ci, Bitbucket.

We can schedule the test suite execution using these CI Tools.

Learn how Continuous Integration with Jenkins in Selenium works

116. Name some CI tools available in the Market?

Some of the best continuous testing softwares to use in your project.

  • Selenium
  • Katalon Studio
  • Appium
  • Unified Functional Testing
  • Travis CI
  • Egg Plant
  • Watir
  • Tricentis Tosca
  • Test Sigma
  • IBM Rational Functional Tester
  • Test Complete
  • QuerySurge
  • JMeter
  • Jenkins
  • Bamboo
  • Docker
  • PagerDuty
  • JIRA
  • GitHub

Read the detailed explanation on Continuous Testing Tools

117. How to achieve Database testing in Selenium?

As we all know Selenium WebDriver is a tool to automate User Interface. We could only interact with Browser using Selenium WebDriver.

Sometimes, we may face a situation to get the data from the Database or to modify (update/delete) the data from the Database.  If we plan to automate anything outside the vicinity of a browser, then we need to use other tools to achieve our task. To achieve the Database connection and work on it, we need to use JDBC API Driver.

The Java Database Connectivity (JDBC) API provides universal data access from the Java programming language. Using the JDBC API, you can access virtually any data source, from relational databases to spreadsheets and flat files. It lets the user connect and interact with the Database and fetch the data based on the queries we use in the automation script. JDBC is a SQL level API that allows us to execute SQL statements. It creates a connectivity between Java Programming Language and the database.

Using JDBC Driver we could do the following

i. Establish a Database connection
ii. Send SQL Queries to the Database
iii. Process the results

118. How to delete Browser Cookies with Selenium Web Driver?

TestNG Interview Questions:

Here we have dealt with some important TestNG interview questions. If you want to learn more interview questions related to TestNG then here you go. We have a special post on TestNG Interview Questions. Also, you could find TestNG Complete Tutorial here

119. What is TestNG?

TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing to integration testing.

120. What are the types of annotations available in TestNG?

@BeforeTest
@AfterTest
@BeforeClass
@AfterClass
@BeforeMethod
@AfterMethod
@BeforeSuite
@AfterSuite
@BeforeGroups
@AfterGroups
@Test

121. What is TestNG Assert and list out some common Assertions supported by TestNG?

TestNG Asserts help us to verify the condition of the test in the middle of the test run. Based on the TestNG Assertions, we will consider a successful test only if it is completed the test run without throwing any exception.

Some of the common assertions supported by TestNG are

  • assertEqual(String actual,String expected)
  • assertEqual(String actual,String expected, String message)
  • assertEquals(boolean actual,boolean expected)
  • assertTrue(condition)
  • assertTrue(condition, message)
  • assertFalse(condition)
  • assertFalse(condition, message)

For Complete Post

122. How to create and run TestNG.xml? 

In TestNG framework, we need to create TestNG XML file to create and handle multiple test classes. We do configure our test run, set test dependency, include or exclude any test, method, class or package and set priority etc in the XML file.

For Complete Post

123. How to set test case priority in TestNG?

We use priority attribute to the @Test annotations. In case priority is not set then the test scripts execute in alphabetical order.

Output:

124. What is Parameterized testing in TestNG?

Parameterized tests allow developers to run the same test over and over again using different values.

There are two ways to set these parameters:

125. How to run a group of test cases using TestNG?

TestNG allows you to perform sophisticated groupings of test methods. Not only can you declare that methods belong to groups, but you can also specify groups that contain other groups. Then TestNG can be invoked and asked to include a certain set of groups (or regular expressions) while excluding another set.  This gives you maximum flexibility in how you partition your tests and doesn’t require you to recompile anything if you want to run two different sets of tests back to back.

Groups are specified in your testng.xml file and can be found either under the <test> or <suite> tag. Groups specified in the <suite> tag apply to all the <test> tags underneath.

View Complete Post

126. What is the use of @Listener annotation in TestNG?

Ans. TestNG listeners are used to configure reports and logging. One of the most widely used listeners in TestNG is ITestListener interface. It has methods like onTestStart, onTestSuccess, onTestFailure, onTestSkipped etc. We should implement this interface creating a listener class of our own. Next, we should add the listeners annotation (@Listeners) in the Class which was created.

Practical Example

127. How can we create a data-driven framework using TestNG?

By using @DataProvider annotation,  we can create a Data-Driven Testing Framework.

Practical Example

128. Where you have applied OOPS in Automation Framework?

 
Here we have given a clear explanation of the application of OOPs in Automation Framework
 

129. How to handle browser (chrome) notifications in Selenium?

Notification Popup
 
 
In Chrome, we can use ChromeOptions as shown below.

I would like to conclude this post here. Final words, Bookmark this post “Selenium Testing Interview Questions” for future reference. We keep on updating this post based on user requests.

130. Mention types of data you have handled in Selenium?

  • Excel
  • CSV
  • XML
  • JSON
  • YAML
  • SQL

Selenium Real Time Interview Questions Videos

Here are some video tutorials which contain real-time selenium interview questions.

We got multiple questions from our readers. Some of them I have included here.

Selenium WebDriver Interview Questions FAQ:

Is there any selenium certification?

Usually, certifications are provided by companies that have developed a proprietary tool like QTP, AWS, Salesforce, etc., Selenium is an open-source software testing tool. There are many certification providers (training institutes) who provide certification in Selenium but Selenium is open source software, it does not offer any certification of their own. If I am in your position, I prefer certification in a programming language like Java instead of Selenium.

Can I learn selenium on my own?

You can self learn Selenium. I know many automation testers who learn selenium on their own by going through Selenium blogs like SoftwareTestingMaterial. Learn Selenium online and practice it until you feel confident. Once you become confident include your automation skills in your resume and if possible showcase your automation skills to your managers. So that you may grab an opportunity in your current organization itself.

Before learning Selenium I suggest you learn

Start with Java and then move on to Selenium.

What are the basics of selenium?

Selenium suite is comprised of 4 basic components namely Selenium IDE, Selenium RC, WebDriver, and Selenium Grid.

Is Selenium easy to learn?

Yes of course. Learning Selenium is easy. Check out our Selenium Tutorial

How many days it will take to learn selenium?

1-2 Months enough if you can spend at least 3-4 hours per day.

Please add Selenium interview questions for freshers

Here we have covered most of the interview questions which help you to attend Selenium Interview as a fresher.

I have three years of experience and I would like to prepare for an interview. Please include Selenium interview questions for 3 years experience.

We have covered Selenium WebDriver interview questions for 3 years experienced too.

I am working as a manual tester and applying for an automation job. Can you please list Selenium interview questions for 5 years experience etc.,

This list of 100+ Selenium Interview questions help you to crack your interview. If you have any queries, you can comment below. Our team will help you.

We are here to help you guys, we will include Selenium advanced interview questions frequently. Also, we are planning to provide Selenium Interview Questions and Answers PDF Download link. Check out this space again to download it.

I hope now you are ready to attend an interview. One last step before doing that. Why can’t you test your knowledge using our popular Selenium Quiz.

Also, learning Java is very important to crack any Selenium Interview. So go through the following guides to gain more knowledge.

In Selenium interviews, interviewers expect you to have good knowledge of Java or Python.

Don’t miss:

Here I have hand-picked a few posts which will help you to learn more interview related stuff:

If you have any more questions, feel free to ask via comments. If you find this post useful, do share it with your friends on Social Networking.

/////


What is automation testing?

Automation testing applies automation processes and tools for testing. Additionally, it is a practice where technicians develop automated testing processes for different systems and tools. In software testing, for example, many companies need people to test their software for different use cases. Instead of having a person go through the program many times using different criteria, a skilled automation specialist can design a software program that can run the different simulations in a fraction of the time, and at a marginal cost.

Related: Learn About Being a Software Engineer

Sample automation testing interview questions

Like many other specialized interview questions, there are a variety of task-specific automation testing questions. You are more likely to encounter these questions for jobs that use automation testing over other types of software engineering or developing roles. In addition to these questions are example answers you may use to help you prepare for your interview.

  1. What do you think are some advantages of automation testing?
  2. What kinds of frameworks have you worked with?
  3. How many test cases have you automated in a day?
  4. How familiar are you with Selenium?
  5. How would you select a test case for automation?
  6. How do you decide which tools to use for automation testing?
  7. What types of tests would you not automate?
  8. Do you have any questions for me?

1. What do you think are some advantages of automation testing?

This is a basic question about automation testing that you might be asked during your interview. Your answer can allow the interviewer to see that your personality and work values match with the requirements of the position, as well as your perception of the advantages involved in automation testing. If you are asked this question, connect your answer to what is important for the business that you are interviewing for. Here is an example:

Example: “I am definitely aware of the advantages of automation testing, and I realize it can determine how automation can impact a company. For instance, results of automation can lead to lowering company costs, freeing up team members to fill other roles and delegating resources to other departments. I am confident in my ability to fully use these advantages for this position.”

Read more: 21 Job Interview Tips: How to Make a Great Impression

2. What kinds of frameworks have you worked with?

If you are presented with this question consider highlighting the different frameworks you have personally worked with, as well as frameworks you are familiar with and would like to learn more about. This can show the interviewer that while you may have only worked with one or two select frameworks, you are familiar with others and are motivated to learn something different. Here is an example:

Example: “I am familiar with keyword-driven and data-driven frameworks, but I have more experience using linear scripting and hybrid frameworks.”

3. How many test cases have you automated in a day?

If presented with this question, your answer can be somewhat subjective. For instance, you might spend your entire workday automating a single test that has a much larger impact than 100 smaller tests. If you generally only do small batches of tests in a day, include a description of what your tasks were and how many you would complete in a day. In both cases, be sure your answer highlights the quality and results of your projects to show the interviewer your skills and understanding of the tasks. The following answer is an example to help you answer this question:

Example: “The number usually depended on the complexity of the test cases. With a limited complexity, I could reasonably automate five to six test cases per day. For more complex scenarios, I was able to automate only one or two test cases per day. I would also break down the most complex test cases into elements like take input, calculation and verifying output to organize the project. Some of these test cases took me two days to complete. So it really depends on the complexity of the test case.”

4. How familiar are you with Selenium?

The interviewer may ask you this question to gauge your skill level when working within the free Selenium framework. Oftentimes, businesses can cut resource costs with free tools, and Selenium can offer a free method of automation testing through its framework. However, if you have limited experience with Selenium, explain what you know of similar frameworks to the interviewer. Also, if you are familiar with working within the Selenium framework, share your experience with the interviewer. Below are two sample answers for either case:

Example: “Selenium supports functional and regression testing, as well as a few different scripting languages like Java and PHP. I am familiar with both testing types as well as the scripting languages supported by Selenium, however, I have only had the opportunity to work within Selenium for six test cases. I hope to have the opportunity to work with it again, as I enjoyed learning the framework.”

Example: “I have no working experience with the Selenium framework, however, I am experienced with the scripting languages Selenium supports. I am confident that with my current skill level, I can learn and operate automation testing within the Selenium framework.”

Read more: Selenium Interview Questions You Might Encounter

5. How would you select a test case for automation?

The interviewer may ask this question to get a sense of your skills in determining the execution frequency for a test case, if a test case is critical for business functions and features, how you would analyze the results of an automated test and how you manage the time it takes to run the test to achieve automation. Consider the following sample answer:

Example: "I would first determine whether the test case is critical to the business or if it just serves an end-to-end scenario. Then, I would plan the execution frequency according to automation needs and begin the test run, while monitoring for defects. As the automation test concludes, I would analyze the results within a time frame that does not exceed the time it would take for manual execution.”

Related: Software Engineer Resume Examples

6. How do you decide which tools to use for automation testing?

The interviewer wants to know your decision process and how you apply the tools you use to the automation testing process. Use this opportunity to highlight your skills as well as your efficiency when completing similar projects. Consider the following sample answer:

Example: “I would start by looking at the requirements to identify which testing scenarios I want to automate. Then I would research the tools that support the project requirements. For these, I determine whether the budget can support necessary resources, either by supplying the necessary tools or hiring skilled personnel as needed. Finally, I would compare the tools needed to ensure they meet key criteria and choose tools that not only fit the criteria but stay within the company budget as well.”

7. What types of tests would you not automate?

If presented with this question, connect your abilities to determine both when to and when not to automate testing. This factor is crucial to determine before beginning automation because it can tell you whether a test type is worth spending the resources on. Likewise, your potential employer may use this question as a way to be certain that you will know how to appropriately allocate tools and resources to perform your job. Consider the following example answer:

Example: “I would not automate test cases that are seldom executed or that are more quickly executed manually. I also would avoid automation testing on cases that extend to exploratory and usability testing, as these test types could present misuse of time and resources.”

8. Do you have any questions for me?

This is a general interview question that can be applied to any position but use this opportunity to ask about the specifications of the position. For example, you might choose to ask about what frameworks the team prefers, what kinds of tests you will be automating and whether you are expected to take on other responsibilities. Here are some examples:





/////////////
  • Question 1. Why Automation Testing?

    Answer :

    • Automation testing improves efficiency of testing.
    • Reduced testing efforts and costs.
    • Testing can be replicated across different platforms.
    • Gives accurate results.
    • Usually used for large applications with stringent deadlines.

  • Question 2. When Will You Automate A Test?

    Answer :

    Automation in preferred in following cases

    • Repetitive Tasks
    • Smoke and Sanity Tests
    • Test with multiple data set
    • Regression test cases

  • Question 3. Explain Load Testing On Websites?

    Answer :

    To access a website, a user sends a “request” to that website’s server, and the server sends back a response in the form of the website you want to access. To load test a website, quality assurance engineers and automation engineers just need to multiply the number of responses sent to simulate different traffic loads. The web server’s response to the influx of virtual users can then be measured. This is used to determine performance issues and server capacity.

  • Question 4. What Are The Features And Benefits Of Quick Test Pro(qtp)?

    Answer :

    The following are the features and benefits of Quick Test Pro:

    • It is a key word driven testing
    • It is suitable for web based application for both client and server
    • It has better error handling mechanism
    • Data driven testing features are excellent
    • It has record and play feature
    • The screen shots can be recorded
    • Run time data table can be used for persisting values

  • Question 5. When You Will Not Automate Testing?

    Answer :

    One should not automate in following cases :

    • When the Application Under Test changes frequently
    • One time test cases
    • Adhoc – Random testing

  • Question 6. Are You Familiar With Selenium? If Yes, What Is It?

    Answer :

    Selenium is a suite of software testing and automation tools built for web applications. Using Selenium, software tests can be written in languages like Java, Perl, Python, and more. The framework itself can be deployed on the three major operating systems: Windows, Mac, and Linux.

  • Question 7. What Is Build Verification Testing, Bvt?

    Answer :

    Build Verification Testing is a group of tests that execute on every newly build of products for verification in which the build is testable prior to the release of build into the hands of the test team. The main stream functionality of the application software is tested using BVT. BVT lets the developers know if any serious problems exist with the build. They save the test team time and frustration by avoiding the test of an unstable build.

  • Question 8. What Are The Steps Involved In The Automation Process ?

    Answer :

    In the automation process, steps involved are

    • Selecting the Test tool
    • Define scope of automation
    • Planning, design and development
    • Test execution
    • Maintenance

  • Question 9. Explain About Basics Of Rational Robot - Ibm Test Automation Tool?

    Answer :

    Rational Robot is an automated testing tool for functional and regression testing for automating Windows, Java, IE and ERP applications which run on Windows platform. The test cases for common objects such as lists, bitmaps, and menus are provided by Rational Robot. It also provides specialized test cases for objects those are specific for development environment. The tools like Relational Test Manager, Rational Clear Quest and Requisite Pro are integrated in the Rational Unified Processor for Change Management, Requirement Traceability and Defect Tracking. It also supports UI technologies such as VS.NET controls, Web, Java, Oracle Forms, Borland Delphi and Sybase Power Builder applications.

  • Question 10. What Are The Points That Are Covered While Planning Phase Of Automation ?

    Answer :

    During planning phase of automation things which has to be taken in concern are

    • Selection the “right” Automation tool
    • Selection Automation Framework if any
    • List of In scope and out of scope items for automation
    • Test Environment setup
    • Preparing Grant Chart of Project timelines for test script development & execution.
    • Identify Test Deliverables

  • Question 11. Can You List Some Other Automation Testing Tools That You Are Familiar With?

    Answer :

    Besides Selenium, there is Load Runner, Sahi, Silk Test, QTP, Jmeter, WinRunner, etc.

  • Question 12. Stop Automating The Tests Which Run Once?

    Answer :

    Ensure that certain test cases might be running once and not included in the regression testing. Avoid automating such test modules.

  • Question 13. In What Condition We Cannot Use Automation Testing For Agile Method ?

    Answer :

    Automation testing is not useful for agile methods in following conditions :

    • When Agile testing always ask for changes in requirements
    • When Exhaustive level of documentation is required in Agile
    • Only suitable for those regression tests during agile testing like continuos integration

  • Question 14. What Kind Of Tests Would You Automate?

    Answer :

    Load tests, sanity tests, and regression tests are the sorts of tests a quality engineer would typically automate.

  • Question 15. What Are The Risks Associated In Automation Testing?

    Answer :

    The risks of Automation Testing are:

    • Do you have skilled resources? The automation testing demands resources with some knowledge about programming. Focus on the resources. Identify whether the resources have proper knowledge for automation testing. Are they capable to adapt easily to the new technologies? These measures are to be well assessed for building an automation testing team.
    • The initial cost for automation is high. The initial cost for automation is too high for initial setup. It costs automated tool purchase, training ad maintenance of the test scripts. The unsatisfied customer base is high for automation testing their products. It should be ensured that the cost compensates the testing results.
    • If UI is not fixed, do not thing about automation: Prior to automating the user interface, it should strongly be determined that, whether the UI is changing extensively or the cost of the automated script maintenance is high or not.
    • Make sure that the application is stable enough: To automate the early development cycle unless or otherwise it is Agile environment, would not be a good idea. It costs script maintenance cost very high.
    • Stop automating the tests which run once: Ensure that certain test cases might be running once and not included in the regression testing. Avoid automating such test modules.

  • Question 16. What Is Tree View In Automation Testing?

    Answer :

    A tree view in Quick Test Pro has statements in keywords or in tree structure. The testing process in the keyword created and viewed in the keyword drive modular format.

  • Question 17. What Are The Primary Features Of Good Automation Tool ?

    Answer :

    • Test Environment support and easy to use.
    • Good debugging facility.
    • Robust object identification.
    • Object and Image testing abilities.
    • Object identification.
    • Testing of database.
    • Support multiple frameworks.

  • Question 18. Does Automation Testing Have Any Disadvantages?

    Answer :

    Designing the tools and tests to run software through takes a lot of manual, human effort, though there are frameworks and tests ready made for engineers to use. Even with automated testing, human error is still a factor – tools can be buggy, inefficient, costly, and sometimes even technologically limited in what kinds of tests they can run on their own.

  • Question 19. What Are The Pre-requisites To Start Automation Testing?

    Answer :

    The first step is to segregate the different test cases that are to be automated, followed by preparing test data as per the needs of the test cases. Reusable functions need to be written which are frequently used in those test cases. Later test scripts are prepared by using reusable functions and apply loops and conditions wherever necessary.

    In a nut shell, the following are the pre-requisites for starting automation testing:

    1. Build should always be stable
    2. Get the functionalities to repeat
    3. Filtering the automated test cases

  • Question 20. What Are The Types Of Framework Used In Software Automation Testing ?

    Answer :

    In software automation testing four types of framework used are

    • Data driven automation framework
    • Keyword driven automati4on framework
    • Modular automation framework
    • Hybrid automation framework

  • Question 21. What Are The Differences Between Open Source Tools, Vendor Tools, And In-house Tools?

    Answer :

    Open source tools are free to use frameworks and applications. Engineers build the tool, and have the source code available for free on the internet for other engineers to use. Vendor tools are developed by companies that come with licenses to use, and often cost money. Because they are developed by an outside source, technical support is often available for use. Example vendor tools include WinRunner, SilkTest, Rational Robot, QA Director, QTP, LR, QC, RFT, and RPT. An in-house tool is a tool that a company builds for their own use, rather than purchasing vendor tools or using open source tools.

  • Question 22. On What Basis You Can Map The Success Of Automation Testing?

    Answer :

    On basis of following criteria the success of automation testing can be mapped

    • Defect Detection Ratio
    • Automation execution time and time savings to release the product
    • Reduction in Labour & other costs

  • Question 23. Explain Load Testing On Websites.?

    Answer :

    To access a website, a user sends a “request” to that website’s server, and the server sends back a response in the form of the website you want to access. To load test a website, quality assurance engineers and automation engineers just need to multiply the number of responses sent to simulate different traffic loads. The web server’s response to the influx of virtual users can then be measured. This is used to determine performance issues and server capacity.

  • Question 24. What Kinds Of Tests Can Be Run With The Selenium Framework?

    Answer :

    Selenium can be used for load testing, regression testing, and functional testing of web applications.

     

     

  • Question 25. Explain How Qtp Identifies Objects?

    Answer :

    For each object class that QTP identifies, it has a set of properties stored. These include mandatory properties, which is essentially a description of any given object, which checks if it’s a child or parent object as well. Next are the assistive properties, which QTP resorts  to only if the mandatory properties are insufficient at identifying the object. If all else fails, QTP resorts, finally, to its ordinal identifier.

  • Question 26. List The Five Essential Types Of Test Steps?

    Answer :

    • Test object
    • Functions
    • Utility
    • Comment
    • Programming logic

  • Question 27. What Environment Does Qtp Run In?

    Answer :

    Windows only.

  • Question 28. What Are Some Test Assets And Related Extensions Of Qtp?

    Answer :

    • test batch runner .mtb
    • results .xml
    • test file .mts
    • recovery scenario .qrs
    • shared object repository .tsr
    • local object repository .mtr
    • function library .qfl

  • Question 29. Can You List Some Technologies That Support Qtp?

    Answer :

    • .NET
    • Delphi
    • Web
    • Java (Core)
    • Java  (Advanced)
    • Windows Mobile
    • Oracle
    • SAP
    • WPF
    • Siebel
    • PeopleSoft
    • Flex
    • Silverlight

  • Question 30. Does The Selenium Ide Have Any Drawbacks?

    Answer :

    The Selenium IDE lacks conditional statements, logging and reporting functionality, loops, database testing, and it can not handle exceptions or automatically re-run tests that have failed. It also can’t take screenshots. Another downside is that it’s Firefox only. If the Selenium IDE is used in the Firefox browser’s side-bar, then the quality engineer can’t use  it to record any actions undertaken by a user in a separate window.

  • Question 31. What Is The Selenium Ide And What Is It Used For?

    Answer :

    The Selenium IDE is an add-on for Firefox that includes numerous features for quality assurance and engineers to record and play back browser-based actions, such as typing and mouse clicks. Some of these particular features are: debugging functions, record/playback ability, user add-on capability. Users can speed up and slow down executions with the use of a built-in slider. They can also use the Selenium IDE as a side-bar, or as a separate pop-up window.

  • Question 32. What Are The Different Types Of Scripting Techniques For Automation Testing?

    Answer :

    Test automation scripting techniques include key and data driven techniques, shared, structured, and linear.
    Check out this course on software testing basics for a more in-depth look at the fundamentals of quality engineering and automation.

  • Question 33. What Is The Selenium Webdriver?

    Answer :

    The Selenium WebDriver is used for automating tests for websites.

  • Question 34. How Do You Choose Which Automation Tool Is Best For Your Specific Scenario?

    Answer :

    In order to choose the proper automation testing tool, you must consider:

    • the scope of the project
    • the limitation of the tool
    • how much the tool costs
    • the tool’s usability and convenience
    • the testing environment
    • compatibility

    Project management and good judgment are important skills in software testing and quality assurance positions. Check out this course on IT  project managementto learn how to make good, effective decisions for your team.

  • Question 35. Is Automation Testing A Complete Replacement For Manual Software Testing?

    Answer :

    No. Proper automation requires as little intervention from humans as possible, since the tools used are built to run tests once they’re setup. As convenient as this might be, it should not be a complete replacement for manual testing – only for repetitive tasks like load testing, where thousands of virtual users are required.  Engineers should not automate things like test scripts, if those scripts can only be expected to run occasionally, nor should they automate code reviews, or bug testing for new builds of software that might require human interaction to detect specific issues. Large-scale, repetitive tasks are better fit for automation.

  • Question 36. Explain Some Disadvantages To Manual Software Testing?

    Answer :

    Manual software testing takes huge amounts of time and resources, both human and machine. It’s a potentially exhausting process that can end up costing more time and money for the company than if the process was simply automated, owing to employee fatigue and its consequences: inaccuracy, missed issues, lack of clarity.


  • /////////////














    TestNG. TestNG. TestNG TestNG. TestNG. TestNG TestNG. TestNG. TestNG

    1. What is TestNG?

    TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing to integration testing. For more information.

    2. What are the advantages of TestNG?

    1. TestNG provides parallel execution of test methods
    2. It allows to define dependency of one test method over other method
    3. It allows to assign priority to test methods
    4. It allows grouping of test methods into test groups
    5. It has support for parameterizing test cases using @Parameters annotation
    6. It allows data driven testing using @DataProvider annotation
    7. It has different assertions that helps in checking the expected and actual results
    8. Detailed (HTML) reports

    3. What are the annotations available in TestNG?

    @BeforeTest
    @AfterTest
    @BeforeClass
    @AfterClass
    @BeforeMethod
    @AfterMethod
    @BeforeSuite
    @AfterSuite
    @BeforeGroups
    @AfterGroups
    @Test

    Practical Example

    4. Can you arrange the below testng.xml tags from parent to child?

    The correct order of the TestNG tags are as follows

    5. How to create and run testng.xml 

    In TestNG framework, we need to create testng.xml file to create and handle multiple test classes. We do configure our test run, set test dependency, include or exclude any test, method, class or package and set priority etc in the xml file.

    View Complete Post

    6. What is the importance of testng.xml file?

    In a Selenium TestNG project, we use testng.xml file to configure the complete test suite in a single file. Some of the features are as follows.

    • testng.xml file allows to include or exclude the execution of test methods and test groups
    • It allows to pass parameters to the test cases
    • Allows to add group dependencies
    • Allows to add priorities to the test cases
    • Allows to configure parallel execution of test cases
    • Allows to parameterize the test cases

    7. How to pass parameter through testng.xml file to a test case?

    We could define the parameters in the testng.xml file and then reference those parameters in the source files.

    Create a java test class, say, ParameterizedTest.java and add a test method say parameterizedTest() to the test class. This method takes a string as input parameter. Add the annotation @Parameters(“browser”) to this method.

    The parameter would be passed a value from testng.xml, which we will see in the next step.

    We could set the parameter using the below syntax in the testng.xml file. 

    Here, name attribute represents the parameter name and value represents the value of that parameter.

    Practical Example

    8. What is TestNG Assert and list out common TestNG Assertions?

    TestNG Asserts help us to verify the condition of the test in the middle of the test run. Based on the TestNG Assertions, we will consider a successful test only if it is completed the test run without throwing any exception.

    Some of the common assertions supported by TestNG are

    • assertEqual(String actual,String expected)
    • assertEqual(String actual,String expected, String message)
    • assertEquals(boolean actual,boolean expected)
    • assertTrue(condition)
    • assertTrue(condition, message)
    • assertFalse(condition)
    • assertFalse(condition, message)

    For Complete Post

    9. What is Soft Assert in TestNG?

    Soft Assert collects errors during @Test. Soft Assert does not throw an exception when an assert fails and would continue with the next step after the assert statement.

    If there is any exception and you want to throw it then you need to use assertAll() method as a last statement in the @Test and test suite again continue with next @Test as it is.

    Practical Example

    10. What is Hard Assert in TestNG?

    Hard Assert throws an AssertException immediately when an assert statement fails and test suite continues with next @Test

    Practical Example

    11. What is exception test in TestNG?

    TestNG gives an option for tracing the Exception handling of code. You can verify whether a code throws the expected exception or not. The expected exception to validate while running the test case is mentioned using the expectedExceptions attribute value along with @Test annotation.

    Practical Example

    12. How to set test case priority in TestNG?

    We use priority attribute to the @Test annotations. In case priority is not set then the test scripts execute in alphabetical order.

    Output:

    13. What is Parameterized testing in TestNG?

    Parameterized tests allow developers to run the same test over and over again using different values.

    There are two ways to set these parameters:

    14. How can we create data driven framework using TestNG?

    By using @DataProvider annotation,  we can create a Data Driven Framework.

    Practical Example

    15. How to run a group of test cases using TestNG?

    TestNG allows you to perform sophisticated groupings of test methods. Not only can you declare that methods belong to groups, but you can also specify groups that contain other groups. Then TestNG can be invoked and asked to include a certain set of groups (or regular expressions) while excluding another set.  This gives you maximum flexibility in how you partition your tests and doesn’t require you to recompile anything if you want to run two different sets of tests back to back.

    Groups are specified in your testng.xml file and can be found either under the <test> or <suite> tag. Groups specified in the <suite> tag apply to all the <test> tags underneath.

    Practical Example

    TestNG Interview Questions 16 – 33

    16. How to create Group of Groups in TestNG?

    Groups can also include other groups. These groups are called MetaGroups. For example, you might want to define a group all that includes smokeTest and functionalTest. Let’s modify our testng.xml file as follows:

    Practical Example

    17. How to run test cases in parallel using TestNG?

    we can use “parallel” attribute in testng.xml to accomplish parallel test execution in TestNG

    The parallel attribute of suite tag can accept four values:

    tests – All the test cases inside <test> tag of testng.xml file will run parallel
    classes – All the test cases inside a java class will run parallel
    methods – All the methods with @Test annotation will execute parallel
    instances – Test cases in same instance will execute parallel but two methods of two different instances will run in different thread.

    Practical Example

    18. How to exclude a particular test method from a test case execution? 

    By adding the exclude tag in the testng.xml

    19. How to exclude a particular test group from a test case execution? 

    By adding the exclude tag in the testng.xml

    Practical Example

    20. How to disable a test case in TestNG ?

    To disable the test case we use the parameter enabled = false to the @Test annotation.

    21. How to skip a @Test method from execution in TestNG?

    By using throw new SkipException()

    Once SkipException() thrown, remaining part of that test method will not be executed and control will goes directly to next test method execution.

    Practical Example

    22. How to Ignore a test case in TestNG?

    To ignore the test case we use the parameter enabled = false to the @Test annotation.

    Practical Example

    23. How TestNG allows to state dependencies?

    TestNG allows two ways to declare the dependencies.

    Using attributes dependsOnMethods in @Test annotations – Practical Example
    Using attributes dependsOnGroups in @Test annotations – Practical Example

    24. What are the different ways to produce reports for TestNG results?

    TestNG offers two ways to produce a report.

    Listeners implement the interface org.testng.ITestListener and are notified in real time of when a test starts, passes, fails, etc…

    Reporters implement the interface org.testng.IReporter and are notified when all the suites have been run by TestNG. The IReporter instance receives a list of objects that describe the entire test run.

    25. What is the use of @Listener annotation in TestNG?

    TestNG listeners are used to configure reports and logging. One of the most widely used listeners in testNG is ITestListener interface. It has methods like onTestStart, onTestSuccess, onTestFailure, onTestSkipped etc. We should implement this interface creating a listener class of our own. Next we should add the listeners annotation (@Listeners) in the Class which was created.

    Practical Example

    26. How to write regular expression In testng.xml file to search @Test methods containing “smoke” keyword.
    Regular expression to find @Test methods containing keyword “smoke” is as mentioned below.
    27. What is the time unit we specify in test suites and test cases? 
    We specify the time unit in test suites and test cases is in milliseconds.

    28. List out various ways in which TestNG can be invoked?

    TestNG can be invoked in the following ways

    • Using Eclipse IDE
    • Using ant build tool
    • From the command line
    • Using IntelliJ’s IDEA

    29. How To Run TestNG Using Command Prompt?

    Run the TestNG using command prompt

    Open command prompt and use the below code

    30. What is the use of @Test(invocationCount=x)?

    The invocationcount attribute tells how many times TestNG should run a test method

    In this example, the method testCase1 will be invoked ten times

    31. What is the use of @Test(threadPoolSize=x)?

    The threadPoolSize attribute tells to form a thread pool to run the test method through multiple threads.

    Note: This attribute is ignored if invocationCount is not specified

    In this example, the method testCase1 will be invoked from three different threads

    32. What does the test timeout mean in TestNG?

    The maximum number of milliseconds a test case should take.

    In this example, the function testCase1 will be invoked ten times from three different threads. Additionally, a time-out of ten seconds guarantees that none of the threads will block on this thread forever.

    33. What are @Factory and @DataProvider annotation?

    @Factory: A factory will execute all the test methods present inside a test class using a separate instance of the respective class with different set of data.

    @DataProvider: A test method that uses DataProvider will be executed the specific methods multiple number of times based on the data provided by the DataProvider. The test method will be executed using the same instance of the test class to which the test method belongs.

    I would like to conclude this post “TestNG Interview Questions” here.

    Final words, Bookmark this post “TestNG Interview Questions” for future reference. After reading this post “TestNG Interview Questions”, if you find that we missed some important questions, please comment below we would try to include those with answers.

    You could find the following Tutorials useful.

    /////////////

    Comments

    Popular posts from this blog

    AWS-NOTES

    AWS API Gateway Interview questions