Automation testing interview questions and answers

Automation testing interview questions are less about one tool's syntax and more about judgment: what is worth automating, how a framework is structured so it survives UI changes and team growth, where tests run in CI, and what you do when a suite starts failing at random. Expect questions on the test pyramid, data-driven, keyword-driven and hybrid frameworks, flaky test policy, reporting, and how to choose between Selenium, Cypress and Playwright.

By Published 8 min read

What automation interviews are really checking

Teams hiring automation engineers have usually been burned by a suite that was slow, flaky or abandoned. So beyond syntax, interviewers look for someone who can decide what deserves a test, design code that other testers can extend, and keep the pipeline trustworthy. A typical loop has a screen on your current framework, a coding round (often plain programming problems on strings, arrays and maps in Java, Python or JavaScript), a hands-on automation task in the team's tool, and a design discussion: "build a framework for this product" or "our suite takes three hours and fails 10% of runs, what do you do?" This page covers the tool-neutral part. For tool details, see the Selenium and Cypress pages.

Fundamentals: why, what and where to automate

Automation questions for freshers and testers moving from manual work
QuestionWhat it testsWhat a strong answer shows
Why automate tests at all?PurposeFast, repeatable feedback on every change, especially for regression. Automation frees people for exploratory work; it does not replace thinking about what to test.
Which tests would you automate first?SelectionStable, high-value flows run on every release: login, core purchase or booking path, critical APIs, and data-heavy checks that are tedious by hand.
What would you not automate?SelectionOne-off checks, features still changing every sprint, usability and visual judgment, and tests whose setup costs more than running them by hand a few times a year.
What is the test pyramid?StrategyMany fast unit tests at the base, a middle layer of service or API tests, and a small number of end-to-end UI tests at the top. Each bug should be caught at the cheapest layer that can see it.
What is the ice cream cone anti-pattern?StrategyThe pyramid upside down: most checks run through the UI, with few unit or API tests. Suites like that are slow, brittle and expensive to maintain.
What is a test automation framework?VocabularyThe structure and shared code around tests: how they are organized, how data and config are supplied, how the app is driven, how results are reported, and the conventions everyone follows.
What types of frameworks exist?VocabularyLinear (record and replay), modular, data-driven, keyword-driven, hybrid and behavior-driven (BDD). Most real frameworks are hybrids.
How do you measure the return on automation?ValueCompare manual effort saved per release and earlier bug detection with the cost to build and maintain the tests. Maintenance cost is the number people forget.
Is 100% automation a sensible goal?JudgmentNo. Some testing is about judgment and discovery. A better goal is that every critical risk has a fast, reliable automated check.
Automation questions for freshers and testers moving from manual work. Scroll sideways on a small screen.

Framework design questions

  • Walk me through the layers of a framework you built. Tests that state intent, a layer that drives the app (page objects or screen objects for UI, client classes for APIs), test data builders or files, environment config, utilities such as waits and logging, and a reporting hook. Tests should not contain raw locators or URLs.
  • What is a data-driven framework? The same test logic runs against many data sets from a table, CSV, JSON or a database query. It suits forms, calculations and validation rules where only inputs and expected outputs change.
  • What is a keyword-driven framework? Test steps are written as keywords such as login, addToCart and checkTotal with arguments, often in a table, and code maps each keyword to an implementation. Non-programmers can write tests; the cost is an extra layer to maintain. Robot Framework is a well-known example.
  • What is a hybrid framework? A mix, usually modular code with page objects, data-driven inputs and sometimes keywords or BDD on top. Explain which parts you combined and why.
  • When does BDD with Cucumber or SpecFlow help, and when does it hurt? It helps when product people actually read or write the Gherkin scenarios. When only testers touch them, the step-definition layer adds indirection without the collaboration benefit.
  • How do you make a framework safe for parallel runs? No shared static state, one browser or client session per test thread, unique test data per test, and tests that do not depend on order.
  • How do you handle environments and secrets? Config per environment (URLs, feature flags) chosen at run time, secrets from the CI secret store or a vault, never committed in config files or test data.
  • How do you manage test data? Create it through APIs or builders at the start of a test, name it uniquely, and clean up or use disposable environments. Fixed shared accounts cause collisions once tests run in parallel.
import { test } from "node:test";
import assert from "node:assert/strict";

// The "application" under test: a cart with a discount rule.
function createCart() {
  const items = [];
  return {
    add: (name, price, qty) => items.push({ name, price, qty }),
    total: () => {
      const sum = items.reduce((s, i) => s + i.price * i.qty, 0);
      return sum >= 100 ? Math.round(sum * 0.9 * 100) / 100 : sum;
    },
  };
}

// Keywords map readable step names to code.
const keywords = {
  openCart: (ctx) => { ctx.cart = createCart(); },
  addItem: (ctx, name, price, qty) => ctx.cart.add(name, Number(price), Number(qty)),
  expectTotal: (ctx, expected) => assert.equal(ctx.cart.total(), Number(expected)),
};

function run(steps) {
  const ctx = {};
  for (const [keyword, ...args] of steps) {
    const fn = keywords[keyword];
    if (!fn) throw new Error("Unknown keyword: " + keyword);
    fn(ctx, ...args);
  }
}

// Data-driven: one scenario shape, several rows of data.
const rows = [
  { name: "below the discount line", price: "30", qty: "3", total: "90" },
  { name: "exactly on the line", price: "50", qty: "2", total: "90" },
  { name: "well above the line", price: "40", qty: "5", total: "180" },
];

for (const row of rows) {
  test("cart total: " + row.name, () => {
    run([
      ["openCart"],
      ["addItem", "mug", row.price, row.qty],
      ["expectTotal", row.total],
    ]);
  });
}
keywords.test.mjs: a minimal keyword-driven and data-driven runner against a fake cart, using Node's built-in test runner. Real frameworks map the same keywords to UI or API actions.

CI integration and reporting

Intermediate questions about running suites in a pipeline
QuestionWhat it testsWhat a strong answer shows
Which tests run on each pull request, and which run nightly?Pipeline designUnit tests and a short smoke set of API and UI tests on every pull request, so feedback arrives in minutes. The full regression and cross-browser runs nightly or before release.
How do you cut a long suite's run time?SpeedParallel workers, sharding across CI machines, moving checks down the pyramid, creating state through APIs instead of clicking through the UI, and removing duplicate tests.
Where do tests run in CI?InfrastructureIn containers with pinned browser and tool versions, or against a browser grid or cloud service, pointed at an ephemeral or dedicated test environment.
What should a failed run leave behind?DebuggingLogs, screenshots, videos or traces, the browser and app versions, and test data IDs, uploaded as build artifacts and linked from the report.
Which reports do you produce?ReportingJUnit XML for the CI system, plus a readable report such as Allure or the tool's HTML report, with history so trends show up.
Should failing tests block a merge?Quality gatesReliable smoke tests should. Tests known to be flaky should be quarantined so they do not block, but they still need an owner and a fix date.
Which metrics do you track for the suite?MetricsPass rate, flake rate per test, run duration, time to fix broken tests, and defects that escaped to production in areas the suite covers.
Intermediate questions about running suites in a pipeline. Scroll sideways on a small screen.
name: ui-regression
on:
  pull_request:
  schedule:
    - cron: "0 2 * * *"

jobs:
  ui-tests:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        shard: [1, 2, 3, 4]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - run: npm ci
      - run: npm run test:ui -- --shard=${{ matrix.shard }}/4
        env:
          BASE_URL: ${{ vars.STAGING_URL }}
          TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          name: ui-report-${{ matrix.shard }}
          path: reports/
A GitHub Actions job that splits a UI suite into four shards and always uploads reports. The test command is a placeholder for your tool's own shard flag.

Flaky tests: detection, quarantine and fixes

  • What is a flaky test? A test that passes and fails on the same code without any change. It erodes trust: once people expect random failures, they start ignoring real ones.
  • How do you find flaky tests? Track results per test across runs, re-run failures automatically once and record when the re-run passes, and run new tests many times before merging them.
  • Should you retry failed tests automatically? One retry can keep a pipeline moving, but only if retried passes are recorded and reported as flakes. Retries that silently turn red into green hide real bugs, including race conditions in the product itself.
  • What is quarantine? Moving a known flaky test out of the blocking run into a separate job, with a ticket, an owner and a deadline. A quarantine with no exit becomes a graveyard.
  • What are the usual root causes? Timing (waiting on time instead of on a condition), shared or leftover test data, order dependence, unstable test environments, third-party services, and test code that assumes a screen size or time zone.
  • How do you prevent new flaky tests? Code review for tests with the same standards as product code, a rule against fixed sleeps, stubbing external services, and a burn-in run for new tests.

Tools, Playwright and senior scenarios

Questions for experienced automation engineers and SDETs
QuestionWhat it testsWhat a strong answer shows
Selenium, Cypress or Playwright for a new web project?Tool choiceSelenium for many languages and browsers and existing grids; Cypress for JavaScript teams who value its runner; Playwright for auto-waiting, Chromium, Firefox and WebKit engines, multiple tabs and contexts, tracing and built-in parallel runs. Decide with the team's language and the app's needs.
What does Playwright do differently?CurrencyIt drives browsers from outside over its own protocol connections, waits for elements to be actionable before acting, isolates tests in browser contexts, and records traces you can replay step by step. It has official bindings for several languages.
You inherit 1,500 UI tests with a 20% failure rate. What do you do?RecoveryMeasure first: which tests fail, how often and why. Quarantine the worst, fix shared causes such as data and waits, delete tests that duplicate lower-level checks, and rebuild trust with a small reliable smoke set.
How do you convince a manager to invest in automation?InfluenceShow the manual regression hours per release, the bugs that escaped, and a small pilot with real numbers on time saved, plus an honest maintenance estimate.
How do you automate tests for a microservices product?ArchitectureUnit and contract tests per service, API tests for important flows across services, a thin layer of end-to-end UI tests, and stubs for services outside the test's scope.
How would you add mobile or visual testing?BreadthAppium or the platform tools (Espresso, XCUITest) for native apps, and visual comparison tools for layout regressions, with baselines reviewed by people.
Where can AI help in test automation, and where would you be careful?JudgmentGenerating test data and first drafts of tests, summarizing failures and suggesting locators. Every generated test still needs review, because a test that asserts the wrong thing is worse than none.
Questions for experienced automation engineers and SDETs. Scroll sideways on a small screen.

Fictional example

Answering "Design an automation approach for an online grocery app from scratch"
Interviewer
We have a web shop and a mobile app on the same backend, no automation yet, and two testers. Where do you start?
Candidate
I would start with risk, not tools. The places where a bug costs most are checkout, payments, delivery slot booking and pricing rules, so those get automated first. Because both apps share the backend, the biggest return is API tests: pricing, promotions, stock and order creation, run on every pull request in a few minutes. Developers own unit tests; I would agree on that with them early. For the UI, I would pick a tool that matches the web team's language, write ten to fifteen end-to-end tests for the critical journeys, set up data through the API so each test owns its own customer and basket, and keep everything else manual and exploratory for now. In CI, the API suite and a UI smoke set block merges; the full UI run is nightly with reports and screenshots. I would track flake rate from day one and quarantine anything unstable with an owner. Mobile automation comes after the web suite is stable, starting with the same critical journeys.

Preparation plan for automation interviews

  1. Refresh the coding basicsPractice string, array and map problems in your framework language for thirty minutes a day; many automation loops include a plain coding round.
  2. Build a small hybrid frameworkPage objects or API clients, data-driven tests, config per environment and an HTML report, in the tool the job asks for.
  3. Put it in CIRun it on every push with sharding, artifacts on failure and a JUnit report, using a free CI service.
  4. Collect flaky test storiesPrepare two real examples: the cause, how you found it and what you changed so it did not come back.
  5. Rehearse the design questionPractice "design an automation strategy for X" for a shop, a bank app and a SaaS dashboard, starting from risk and the pyramid.

Automation builds on test design, so the manual testing questions are worth a review, and the Jest questions cover the unit layer of the pyramid. Pipelines are often shared with platform teams; DevOps engineer interview questions show their side.

Framework design questions reward a clear, ordered explanation, and that is easiest to fix by rereading one. Natively, an AI interview assistant that works on Mac and Windows, transcribes your practice design session so you can see whether you started from risk or jumped to tools. While you practice it can read a screenshot of a failing CI report or a coding problem and help you reason about it, assist with framework code, and, with Pro or the free trial, use the résumé and job description you add. Afterwards the transcript and notes are there to go through.

Questions people ask

What automation testing questions are asked in interviews?

What to automate and what not to, the test pyramid, data-driven, keyword-driven and hybrid frameworks, BDD, test data, running suites in CI, flaky test handling, reporting and choosing between Selenium, Cypress and Playwright.

What is the difference between data-driven and keyword-driven frameworks?

A data-driven framework runs the same test logic with many sets of inputs and expected results. A keyword-driven framework writes steps as reusable keywords with arguments that code maps to actions, so non-programmers can compose tests.

How do you handle flaky automated tests?

Track results per test, record retried passes as flakes instead of hiding them, quarantine unstable tests with an owner and a deadline, and fix root causes such as fixed waits, shared data and unstable environments.

What automation questions do experienced SDETs get?

Designing a strategy for a new product, recovering a large unreliable suite, cutting CI run time, convincing managers to invest, testing microservices and choosing tools for a team.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP