Skip to content

Automation Testing Mock Interview: 20 Questions in 50 Minutes

Four rounds that copy a real interview. Answer aloud, then check the model answers.

Mock interview format

  1. Warm-up · 5 minutes — 4 questions
  2. Technical · 20 minutes — 7 questions
  3. Scenario · 15 minutes — 5 questions
  4. HR & behavioural · 10 minutes — 4 questions

Tip: record yourself and listen back. Most people talk too fast and skip the key idea.

Mock progressStart practicing
3 QUESTIONS FREESign up 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

What is TestNG and why is it used with Selenium?

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

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

What is a .gitignore file and what should an automation project ignore?

Save to ▾
Show answer
A .gitignore lists files Git should not track. In a Java automation project ignore target/, test-output/, allure-results/, reports, screenshots, logs, IDE folders like .idea and .vscode, *.iml, OS files like .DS_Store, and local config files holding secrets. Ignoring generated output keeps the repository small and avoids noisy diffs and conflicts.
04

List common TestNG annotations and their order.

Warm-upTestNG FrameworkEasy
Save to ▾
Show answer
BeforeSuite, BeforeTest, BeforeClass, BeforeMethod, Test, AfterMethod, AfterClass, AfterTest and AfterSuite.
05

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

TechnicalSelenium WebDriverMedium
Save to ▾
Show answer
close() closes the current window; quit() closes all windows and ends the driver session.
06

How do you upload a file with REST Assured?

TechnicalREST AssuredMedium
Save to ▾
Show answer
Use multipart: given().multiPart("file", new File("src/test/resources/report.pdf"), "application/pdf").formParam("type", "invoice").when().post("/upload").then().statusCode(200). REST Assured sets the multipart/form-data content type automatically. Verify both the status and the response, such as the returned file id or size, and test edge cases like empty, oversized and wrong-type files.
07

How do you pass authentication in an API test?

TechnicalREST AssuredMedium
Save to ▾
Show answer
Use headers such as Bearer tokens, basic auth, API keys or OAuth flows; fetch a token in a setup step and reuse it.
08

How do you retry failed tests in TestNG?

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

Write a GET test in REST Assured.

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

How do you make WebDriver thread-safe for parallel runs?

TechnicalPage Object ModelMedium
Save to ▾
Show answer
Store each driver in a ThreadLocal so every thread gets its own instance and tests do not interfere.
11

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

TechnicalCore Java for TestersMedium
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.
12

How would you design an automation framework from scratch?

ScenarioPage Object ModelHard
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.
13

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

A TestNG test passes when run alone but fails when the full class runs. What do you check?

ScenarioTestNG FrameworkMedium
Save to ▾
Show answer
Look for shared state between methods: instance or static fields changed by earlier tests, data created or deleted by another test, cookies or logged-in session kept in the same browser, and priority or order assumptions. Run the class in a different order to confirm. Fix by resetting state in @BeforeMethod, creating unique data per test and avoiding static fields.
15

Chrome inside a Docker node keeps crashing with session deleted because of page crash. How do you fix it?

Save to ▾
Show answer
This is almost always shared memory exhaustion, because Docker's default /dev/shm of 64 MB is too small for Chrome. Set shm_size: 2gb in Compose or --shm-size=2g in docker run. Also check the container's memory limit and the number of sessions per node, since several browsers in one container multiply memory use. Heavy pages or memory leaks in long sessions can also crash tabs, so restart sessions between test classes.
16

Tests pass on QA but fail in the staging pipeline. How do you investigate?

ScenarioAPI Testing and CI/CDMedium
Save to ▾
Show answer
Compare what differs: configuration URLs, test data, feature flags, user permissions, network or proxy, browser versions and timing due to slower servers. Check logs and screenshots from staging and rerun one failing test with verbose logging. Often the issue is missing data or a flag. Fix by making environment settings explicit and creating required data in test setup.
17

Tell me about a time you had to learn Java quickly for an automation role.

HR & behaviouralCore Java for TestersEasy
Save to ▾
Show answer
Situation: I moved from manual testing into an automation team using Java. Task: become productive within a month. Action: I practised core Java daily, focusing on OOP, collections and exceptions, solved small coding problems, and read the existing framework code with a senior's help. Result: in four weeks I was writing page objects and tests that passed review, and I kept learning streams afterwards.
18

Tell me about a time you led the design of a test framework for a new project.

HR & behaviouralPage Object ModelHard
Save to ▾
Show answer
Situation: a new product had no automation and a three-month release target. Task: I was asked to set up the framework and guide two juniors. Action: I chose Java, TestNG, Selenium with POM and REST Assured, set up Maven, Jenkins and Allure, wrote conventions and reviewed every pull request early on. Result: we had 250 stable tests in CI before release, and the juniors could extend it independently.
19

Describe a time you improved the maintainability of an automation framework.

HR & behaviouralPage Object ModelMedium
Save to ▾
Show answer
Situation: our suite had duplicated locators across 200 tests and each UI release broke many of them. Task: reduce maintenance effort. Action: I introduced page objects and components for the top ten pages, added data-testid attributes with the developers and wrote a short guide. Result: fixing a UI change went from half a day to under an hour, and new joiners wrote tests faster.
20

How do you keep your Java and automation skills up to date?

HR & behaviouralCore Java for TestersEasy
Save to ▾
Show answer
Situation: tools change fast, and my team was still on older Selenium and Java versions. Task: keep myself and the framework current. Action: I follow release notes, try new features in a small personal project, and present one useful change to the team each quarter, such as moving to java.time or Selenium 4 relative locators. Result: we upgraded smoothly and I became the go-to person for upgrades.

Frequently asked questions

How do I use this mock interview?

Set a 50-minute timer, answer every question aloud (or ask a friend to read them), and open answers only after each round. Note every question where your answer missed the key idea.

How often should I take a mock?

Once a week while preparing and once two or three days before a real interview. The question order is fixed, so for fresh practice use the company and experience pages too.