Skip to content

Automation Testing Interview Questions for Associate Roles (₹6–8 LPA)

Prepare with questions tailored to the role, required skills, and experience level.

What ₹6–8 LPA interviews expect

Hands-on problem solving Debugging simple real-world issues Clear communication of results Working knowledge of core tools
Solved in this bandStart practicing
3 QUESTIONS FREESign up or log in to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
3 questions free Unlock the rest in seconds
01

How would you automate a login flow with multiple user roles?

₹6–8 LPAAlso asked at WiproHard
Save to ▾
Show answer
Keep credentials in external data, parameterise the test with a data provider, reuse a login method in a page class, and clear sessions between roles.
02

How does the DataProvider annotation work?

Save to ▾
Show answer
A method annotated with @DataProvider returns a 2D object array and the test with dataProvider = "name" runs once per row.
03

How do you switch between windows and tabs?

Save to ▾
Show answer
Get getWindowHandles(), loop to find the target, and call driver.switchTo().window(handle); switch back using the stored parent handle.
04

What is the difference between throw and throws?

Save to ▾
Show answer
throw actually raises an exception object inside a method; throws declares in the method signature that it may pass an exception to the caller.
05

How do you calculate automation ROI?

Save to ▾
Show answer
Compare effort saved by running automated tests repeatedly against the cost of building and maintaining scripts, counting execution time, defects found earlier and release speed.
06

What is the execution order of TestNG annotations?

Save to ▾
Show answer
@BeforeSuite → @BeforeTest → @BeforeClass → @BeforeMethod → @Test → @AfterMethod → @AfterClass → @AfterTest → @AfterSuite.
07

What is BDD and how does Cucumber work?

Save to ▾
Show answer
Behaviour-driven development writes scenarios in Given-When-Then Gherkin that map to step definitions in code, so business and QA share one language.
08

What is the use of the this and super keywords?

Save to ▾
Show answer
this refers to the current object; super refers to the parent class, used to call parent constructors and methods.
09

How do you take a screenshot on failure in TestNG?

Save to ▾
Show answer
Implement ITestListener.onTestFailure(): File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); then copy it into the reports folder.
10

Implicit vs explicit vs fluent wait?

Save to ▾
Show answer
Implicit wait applies globally to element lookups. Explicit wait waits for a specific condition (WebDriverWait + ExpectedConditions). Fluent wait is an explicit wait with custom polling and ignored exceptions.
11

What is the purpose of testng.xml?

Save to ▾
Show answer
A configuration file to define suites, tests, classes, groups, parameters and parallel execution settings.
12

What is the Hybrid framework?

Save to ▾
Show answer
A framework combining data-driven, keyword-driven and POM approaches with reporting and utilities, giving flexibility and reuse.
13

Where do you use OOP concepts in your framework?

Save to ▾
Show answer
Encapsulation: private locators with public page methods. Inheritance: pages extend a BasePage. Polymorphism: the WebDriver interface for different browsers. Abstraction: utility layers hiding Selenium details.
14

What is CI/CD and why does automation need it?

Save to ▾
Show answer
Continuous Integration builds and tests every commit, and Continuous Delivery ships automatically. Automated tests give fast feedback and gate releases.
15

What is a webhook and how do you test it?

Save to ▾
Show answer
A callback where one system sends an HTTP request to another when an event occurs. Test with a mock receiver or tools such as webhook.site and verify the payload.
16

Write a GET test in REST Assured.

Save to ▾
Show answer
given().baseUri(url) .when().get("/users/1") .then().statusCode(200).body("id", equalTo(1));
17

What is polymorphism and how does it show up in Selenium?

Save to ▾
Show answer
One interface, many forms. WebDriver driver = new ChromeDriver() lets the same test code run on any browser class that implements WebDriver.
18

How do you manage test data in a framework?

Save to ▾
Show answer
Use external files or APIs and database setup scripts, generate unique data per run, and clean up afterwards so tests stay independent.
19

How do you validate a JSON response in REST Assured?

Save to ▾
Show answer
Use then().statusCode(200).body("data.id", equalTo(5)), or extract() the response and assert fields with JsonPath.
20

What is TestNG and why is it used with Selenium?

Save to ▾
Show answer
A test framework offering annotations, grouping, prioritisation, parallel runs, data providers and reports, which structure and scale Selenium tests.
21

What is WebDriver and how does it communicate with the browser?

Save to ▾
Show answer
WebDriver sends commands over HTTP (W3C protocol) to a browser-specific driver such as chromedriver, which controls the actual browser.
22

How do you handle multiple windows?

Save to ▾
Show answer
String parent = driver.getWindowHandle(); for (String h : driver.getWindowHandles()) if (!h.equals(parent)) driver.switchTo().window(h); // ...then switch back to parent
23

How would you design an automation framework from scratch?

Save to ▾
Show answer
Maven project → POM with a BasePage → driver factory with ThreadLocal → config files → data-driven utilities (Excel/JSON) → TestNG or Cucumber runner → logging → Extent reports with screenshots on failure → Jenkins pipeline.
24

What are Java collections and which ones do testers use most?

Save to ▾
Show answer
ArrayList and LinkedList for lists, HashSet for unique values, HashMap for key-value test data, and Iterator for traversing them, for example collecting web elements in a list.
25

What are try-with-resources and why use them?

Save to ▾
Show answer
A try block that automatically closes resources such as file readers or streams, preventing leaks without a finally block.
26

How do you handle iframes?

Save to ▾
Show answer
switchTo().frame(index, name or element) enters the frame, and switchTo().defaultContent() returns to the main page.
27

What is REST Assured?

Save to ▾
Show answer
A Java library that makes API tests readable using given-when-then, with easy request building, response validation and JSON path support.
28

What is data-driven testing?

Save to ▾
Show answer
Running the same test logic with multiple data sets from Excel, CSV, JSON or a database, so coverage increases without duplicating code.
29

How do you test an API that depends on another service that is down?

Save to ▾
Show answer
Use mocks or stubs such as WireMock to simulate the dependency and test your service in isolation.
30

findElement vs findElements?

Save to ▾
Show answer
findElement returns the first match and throws NoSuchElementException if nothing is found. findElements returns a List (empty if nothing is found) — handy to check whether an element exists.
31

How do you handle environment-specific configuration?

Save to ▾
Show answer
Keep URLs and credentials in per-environment config files or variables, choose with a command-line parameter and never hard-code secrets.
32

What are access modifiers in Java?

Save to ▾
Show answer
public (everywhere), protected (package and subclasses), default (package) and private (same class), used to control visibility of test utilities.
33

How do you reduce flakiness in a CI pipeline?

Save to ▾
Show answer
Stabilise waits and data, isolate tests, use retries cautiously, quarantine unstable tests, run in consistent containers and track flaky rates.
34

What is the difference between SOAP and REST?

Save to ▾
Show answer
SOAP is a strict XML protocol with WSDL and WS-Security; REST is a lighter architectural style using HTTP and usually JSON.
35

Tests pass locally but fail on Jenkins. Why?

Save to ▾
Show answer
Headless mode or screen resolution, timing issues, environment data, missing dependencies, browser–driver version mismatch or parallel conflicts. Check logs and failure screenshots and make waits robust.
36

How do you retry failed tests in TestNG?

Save to ▾
Show answer
Implement IRetryAnalyzer with a retry count and attach it through the test annotation or a listener to rerun flaky tests.
37

Explain your CI/CD pipeline for tests.

Save to ▾
Show answer
Code pushed to Git → Jenkins job triggers (webhook or schedule) → mvn clean test with the suite XML → reports and screenshots published → notifications on Slack/email → failures triaged before release.
38

How does HashMap work internally?

Save to ▾
Show answer
It uses the key's hashCode to find a bucket and equals to resolve collisions, giving O(1) average lookups; Java 8 converts long buckets into trees.
39

What is the use of Maven in automation projects?

Save to ▾
Show answer
It manages dependencies through pom.xml, builds the project, runs tests with Surefire and standardises structure across teams.
40

What is JSON and how is it used in API testing?

Save to ▾
Show answer
A lightweight text format of key-value pairs and arrays used in API requests and responses, validated field by field in tests.
41

How do you pass parameters from testng.xml?

Save to ▾
Show answer
Define parameter name and value in the XML and read them with @Parameters in the test or configuration method.
42

Method overloading vs overriding?

Save to ▾
Show answer
Overloading: same method name, different parameters, in the same class (compile time). Overriding: a subclass redefines a parent method with the same signature (runtime polymorphism). WebDriver driver = new ChromeDriver() is runtime polymorphism.
43

What are wrapper classes in Java?

Save to ▾
Show answer
Classes such as Integer and Double that wrap primitive types as objects, needed for collections and for parsing text from web elements.
44

What is the difference between an array and an ArrayList?

Save to ▾
Show answer
Arrays have a fixed size and can hold primitives; ArrayList grows dynamically, holds objects and offers helper methods.
45

What is the difference between getText() and getAttribute()?

Save to ▾
Show answer
getText returns visible inner text; getAttribute returns an HTML attribute or property such as value, href or class.
46

What are the different types of waits in Selenium?

Save to ▾
Show answer
Implicit, explicit (WebDriverWait with ExpectedConditions) and fluent waits; avoid mixing implicit and explicit waits and never rely on Thread.sleep.
47

What is Docker and how does it help tests?

Save to ▾
Show answer
Docker packages tools in containers so tests run identically everywhere; Selenium Grid and browsers can be started quickly in containers.
48

What are the Actions class use cases?

Save to ▾
Show answer
Mouse and keyboard actions such as hover, drag and drop, double click, right click and key combinations, built with moveToElement(...).perform().
49

How do you handle a web table in Selenium?

Save to ▾
Show answer
Locate rows and columns with XPath such as //table//tr and //td, loop through them to read or click cells, or build the XPath dynamically from the row text.
50

Difference between ArrayList and LinkedList?

Save to ▾
Show answer
ArrayList has fast random access and slower inserts in the middle; LinkedList has fast inserts and deletes but slow access by index.
51

ArrayList vs HashMap — how do you use them in a framework?

Save to ▾
Show answer
ArrayList stores an ordered list (e.g. all product names on a page). HashMap stores key–value pairs (e.g. test data or config properties).
52

What is Selenium Grid and why use it?

Save to ▾
Show answer
It runs tests in parallel across multiple machines and browsers using a hub and nodes, cutting execution time and increasing browser coverage.
53

What are listeners in TestNG?

Save to ▾
Show answer
Classes like ITestListener that react to events such as test start, success or failure, commonly used for screenshots and reporting.
54

What is method overriding and where is it useful in frameworks?

Save to ▾
Show answer
A subclass redefines a parent method. Frameworks use it to customise base behaviour, such as overriding a wait or click method in a base page class.
55

Common HTTP status codes?

Save to ▾
Show answer
200 OK, 201 Created, 204 No Content, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 500 Internal Server Error.
56

How do you handle dropdowns in Selenium?

Save to ▾
Show answer
Use the Select class with selectByVisibleText, selectByValue or selectByIndex; for custom dropdowns click and choose from the list of elements.