Skip to content

Automation Engineer interview questions

100 real questions with model answers and explanations for QA Automation Engineer candidates.

See a Automation Engineer resume example

Practice with flashcards

Spaced repetition · Hunter Pass

Questions

A test is a good automation candidate when it is repeatable, valuable, and has an objective result.

  • Regression and smoke checks run often, so automation saves repeated manual effort.
  • Stable inputs and observable outputs let the script make a deterministic pass or fail decision.
  • Data-heavy checks benefit because a script can cover many input combinations consistently.
  • A one-time check on a changing prototype usually costs more to automate than to run manually.

Why interviewers ask this: The interviewer checks whether you select automation work by repeatability, value, and stability rather than trying to automate everything.

testing

Tests that depend on human judgment, change constantly, or run only once usually remain manual.

  • Exploratory testing relies on observation and follow-up questions that a fixed script cannot predict.
  • Usability, visual appeal, and wording quality need human judgment unless the acceptance rule is measurable.
  • A rapidly changing prototype makes selectors and flows expensive to maintain.
  • Rare checks with low business risk may never repay the cost of implementation and maintenance.

Why interviewers ask this: A strong answer recognizes the limits and maintenance cost of automation instead of treating manual testing as obsolete.

A deterministic test produces the same result whenever the code and controlled inputs are the same.

  • It controls time, randomness, test data, and external dependencies instead of inheriting changing values.
  • It waits for a measurable state, such as an element becoming visible, rather than sleeping for 5 seconds.
  • It creates or resets its own data so another test cannot change the expected result.
  • Repeating a deterministic test 20 times against the same build should not alternate between pass and fail.

Why interviewers ask this: The interviewer evaluates whether you understand that reliable automation requires controlled inputs and observable synchronization.

pyramid

The test pyramid recommends many fast unit tests, fewer integration tests, and a small number of end-to-end tests.

  • Unit tests isolate small pieces of logic and should provide feedback in milliseconds.
  • Integration tests verify real boundaries such as application code with a database or HTTP service.
  • End-to-end tests cover critical user journeys but cost more to run and maintain.
  • The shape keeps feedback fast while still checking that the assembled product works.

Why interviewers ask this: The interviewer checks whether you can balance speed, isolation, realism, and maintenance across test layers.

batchconcurrency

I would define the expected summary, file set, and file contents from a small controlled input before running the batch.

  • The fixture would contain known records so expected counts, statuses, and assignment to each output file can be calculated independently of the implementation.
  • I would parse the JSON and assert its schema and stable values instead of comparing raw text whose property order may vary.
  • I would assert that the output directory contains exactly two completed files, then parse them and compare required rows, fields, and ordering only where ordering is part of the contract.
  • Generated timestamps or IDs would be controlled or normalized, and temporary or unexpected files would fail the test.

Why interviewers ask this: The interviewer checks whether you can turn content, side effects, and stable comparison rules into an observable pass or fail decision for non-UI automation.

regression

Smoke testing checks that the build is basically usable, while regression testing checks that existing behavior still works broadly.

  • A smoke suite covers a few critical paths such as startup, login, and one core transaction.
  • It runs quickly after a deployment or build and stops deeper testing if the product is unusable.
  • A regression suite covers many previously working features and usually takes longer.
  • Both can be automated, but the smoke suite should remain small enough to give rapid feedback.

Why interviewers ask this: The interviewer wants a clear distinction in purpose, breadth, and execution timing.

requirementstesting

Functional testing checks what the system does, while non-functional testing checks qualities of how it operates.

  • A functional check verifies behavior such as creating an order with valid data.
  • Non-functional checks cover qualities such as response time, accessibility, security, and reliability.
  • Both need measurable expectations, for example status 201 for creation or p95 latency below 500 ms.
  • A feature can be functionally correct yet unacceptable because it is too slow or inaccessible.

Why interviewers ask this: The interviewer checks whether you separate business behavior from measurable quality attributes.

A useful assertion checks one observable requirement with an exact and stable expectation.

  • Verify a meaningful result such as status 201 and the created record ID, not merely that no exception occurred.
  • Compare stable fields and ignore generated timestamps or random IDs unless the test controls them.
  • Include expected and actual values in failure output so the cause is visible without rerunning locally.
  • Avoid assertions tied to unrelated page text because harmless text changes would create false failures.

Why interviewers ask this: The interviewer evaluates whether your assertions detect real defects without coupling tests to unstable details.

automationpython

Lists, dictionaries, sets, tuples, and strings cover most basic test data and result handling.

  • A list preserves order and can hold a sequence of test cases or returned records.
  • A dictionary maps field names to values, which fits JSON payloads such as name and email.
  • A set removes duplicates and supports quick membership checks, while a tuple represents a fixed group of values.
  • Choosing the type by its behavior makes assertions clearer than forcing all data into strings.

Why interviewers ask this: The interviewer checks practical command of Python collections used to prepare inputs and inspect results.

python

Use the with statement so Python closes the file even when an error occurs.

  • Open text files with an explicit encoding such as UTF-8 to avoid machine-dependent decoding.
  • Choose the mode deliberately: r reads, w replaces content, and a appends.
  • Read large files line by line instead of loading the entire file into memory.
  • Handle expected exceptions such as FileNotFoundError and report the affected path.

Why interviewers ask this: A strong answer covers resource cleanup, encoding, modes, and predictable error handling.

python

pathlib represents paths as objects and keeps path operations readable and portable.

  • Path(base) / results.xml joins components with the correct separator for the operating system.
  • Methods such as exists, mkdir, read_text, and glob express common file work directly.
  • resolve can produce an absolute path when a tool needs one.
  • It avoids manual string concatenation that can introduce doubled or wrong separators.

Why interviewers ask this: The interviewer checks whether you can write file automation that behaves consistently across environments.

configpython

Read environment-specific configuration at runtime and validate required variables before tests start.

  • os.getenv can read values such as BASE_URL, BROWSER, or a test account name.
  • Supply defaults only for safe optional settings, such as BROWSER defaulting to chromium.
  • Fail with a clear message when a required value is absent instead of passing None deeper into the code.
  • Never print or commit passwords, tokens, or API keys read from the environment.

Why interviewers ask this: The interviewer evaluates basic configuration hygiene and awareness that secrets must stay out of source code and logs.

python

Use subprocess.run with explicit arguments and inspect the process result.

  • Pass an argument list such as git, status instead of building one shell string from untrusted input.
  • Set check=True when a nonzero exit code should raise CalledProcessError.
  • Use capture_output=True and text=True when the script needs readable stdout and stderr.
  • Add a timeout so a stuck external tool cannot block the automation indefinitely.

Why interviewers ask this: A strong answer shows safe argument passing plus explicit handling of exit codes, output, and timeouts.

concurrency

An exit code communicates whether a command succeeded, with 0 conventionally meaning success and nonzero meaning failure.

  • A shell, CI runner, or parent process uses the code to decide whether the next step should run.
  • Different nonzero values can distinguish invalid input from a test failure or missing dependency.
  • A script should print a useful error to stderr before returning a failure code.
  • Swallowing an error and exiting with 0 can make a broken test job appear green.

Why interviewers ask this: The interviewer checks whether you understand the contract between automation scripts and CI systems.

error-handlingpython

Catch only exceptions you can handle or enrich, and let unexpected failures remain visible.

  • Catch a specific type such as JSONDecodeError rather than a broad Exception when parsing a result file.
  • Add context such as the file path or command name, then preserve the original cause when re-raising.
  • Use finally for cleanup that must happen on both success and failure.
  • Never use an empty except block because it turns a real failure into misleading test output.

Why interviewers ask this: The interviewer evaluates whether error handling preserves diagnostic information instead of hiding defects.

Reliable Bash scripts quote variables, check command failures, and make pipeline behavior explicit.

  • Use double quotes around expansions such as $file so spaces do not split one path into several arguments.
  • A pipeline connects stdout from one command to stdin of the next, as in a producer followed by grep.
  • set -e exits on many unhandled nonzero statuses, but conditions, command lists, and parts of pipelines have contextual exceptions, so expected failures should be handled explicitly and set -o pipefail should expose failures inside pipelines.
  • Send diagnostics to stderr and return a nonzero exit code when the script cannot complete.

Why interviewers ask this: A strong answer identifies quoting and failure propagation as core safeguards in shell automation.

git

Create a focused branch, make small commits, and submit the change for review before merging.

  • Start from an updated main branch so the test change is based on current code.
  • Use git status and git diff to inspect exactly which files and lines will be committed.
  • Write a concise commit message that states what behavior the change adds or fixes.
  • Push the branch and open a pull request so tests and review run before main changes.

Why interviewers ask this: The interviewer checks whether you can contribute test code through a disciplined team workflow.

git

A merge conflict occurs when Git cannot safely combine competing changes and needs a human decision.

  • Git marks the conflicting sections from the current branch and the incoming branch in the file.
  • Read both versions, keep the intended final content, and remove all conflict markers.
  • Run the relevant tests after editing because a syntactically resolved file can still be logically wrong.
  • Stage the resolved file and complete the merge or rebase according to the team's workflow.

Why interviewers ask this: The interviewer evaluates whether you treat conflict resolution as a code decision followed by verification.

pytest

pytest finds tests by naming conventions and then collects matching functions and classes.

  • By default it searches files named test_*.py or *_test.py.
  • It collects functions named test_* and methods named test_* inside classes named Test*.
  • Test classes should not define an __init__ method because pytest instantiates them itself.
  • pytest --collect-only shows what would run without executing the tests.

Why interviewers ask this: The interviewer checks whether you understand why a valid-looking pytest test may or may not be collected.

pytestfixtures

A pytest fixture provides reusable setup data or resources to tests through function arguments.

  • Mark a provider with pytest.fixture and request it by using its name as a test parameter.
  • A fixture can return test data, a configured API client, or a browser page.
  • Code after yield performs teardown, such as closing a connection after the test.
  • Fixtures reduce duplicated setup while keeping dependencies visible in each test signature.

Why interviewers ask this: A strong answer explains dependency injection, reuse, and teardown rather than calling fixtures generic setup functions.

Locked questions

  • 21

    What do pytest fixture scopes control?

    pytestfixtures
  • 22

    What does pytest.mark.parametrize do?

    pytestparametrize
  • 23

    What are pytest markers used for?

    pytest
  • 24

    How do plain assertions work in pytest?

    pytest
  • 25

    How do you verify an expected exception with pytest?

    pytesterror-handling
  • 26

    What is mocking in a pytest unit test?

    unitmockingpytest
  • 27

    How do monkeypatch and tmp_path help pytest tests?

    pytest
  • 28

    What does Selenium WebDriver do?

    selenium
  • 29

    What is the DOM and why does browser automation use it?

    dom
  • 30

    What makes a browser locator reliable?

    locators
  • 31

    When would you use a CSS selector versus XPath?

    csslocators
  • 32

    What is an explicit wait in Selenium?

    selenium
  • 33

    Why are explicit waits usually better than fixed sleeps or broad implicit waits?

  • 34

    What element states should a browser test distinguish?

  • 35

    How should browser setup and cleanup be organized in tests?

    testing
  • 36

    How does Playwright auto-waiting help browser tests?

    playwright
  • 37

    What is a browser context in Playwright?

    playwright
  • 38

    Which Playwright locator strategies should a junior automation engineer prefer?

    playwrightlocators
  • 39

    What is the Page Object Model?

    pom
  • 40

    When and how should browser tests capture screenshots?

    testing
  • 41

    What is a REST API from a test automation perspective?

    restautomation
  • 42

    What do the main HTTP methods mean in API tests?

    httptesting
  • 43

    Which HTTP status codes should a junior API tester know?

    httpstatus-codes
  • 44

    What should JSON schema validation check in an API test?

    schemaapivalidation
  • 45

    How is token authentication represented in a basic API test?

    authtokensapi
  • 46

    What should a basic automated API response check include?

    api
  • 47

    How can SQL be used to verify an automated test result?

    sql
  • 48

    What is the difference between a Docker image and a container?

    dockercontainers
  • 49

    Why run automated tests with Docker?

    docker
  • 50

    What is continuous integration and where do automated tests fit?

    ci-cd
  • 51

    A login test expects an error after three wrong passwords, but the account becomes locked and later tests fail. How would you fix the test?

    passwordstesting
  • 52

    How would you automate a registration form where the Submit button becomes enabled only after all fields are valid?

    forms
  • 53

    A browser test clicks Export and should receive a CSV file. What would you verify?

  • 54

    How would you test a profile image upload that accepts PNG files up to 2 MB?

  • 55

    Clicking Terms opens a new browser tab, but the test keeps searching in the original tab. How would you handle it?

  • 56

    A Delete button opens a browser confirmation dialog. How would you automate both Cancel and Confirm?

  • 57

    A card payment field is inside an iframe and the normal locator cannot find it. What would you do?

    locators
  • 58

    How would you reuse an authenticated browser session without logging in through the UI before every test?

    sessionslogging
  • 59

    A Save locator matches three buttons and the test clicks the wrong one. How would you repair it?

    locators
  • 60

    A results table appears between 1 and 8 seconds after Search, and a two-second sleep is flaky. What wait would you use?

    flaky
  • 61

    A test finds a row, refreshes the table, and then gets a stale element error when clicking that row. Why, and how would you fix it?

  • 62

    Two browser tests pass alone but fail together because one leaves a consent cookie and an open modal. How would you isolate them?

    cookiestesting
  • 63

    How would you automate a REST CRUD flow for a new customer?

    rest
  • 64

    An endpoint returns a large JSON order object. How would you validate its response without asserting every value?

    validationendpoints
  • 65

    What API automation cases would you write for a Bearer-token protected endpoint?

    endpointstokens
  • 66

    How would you test a paginated endpoint that returns 25 items per page?

    endpoints
  • 67

    An API creates invoices from JSON. Which negative payload cases would you automate first?

    api
  • 68

    How would you test update and delete behavior for a resource ID that does not exist?

  • 69

    A users endpoint supports status and created_after filters. How would you test them?

    endpoints
  • 70

    A client times out after sending Create payment and retries the request. What idempotency behavior should your test check?

    idempotency
  • 71

    How would you test that an API rejects an unsupported HTTP method?

    http
  • 72

    An API sometimes returns 429 Too Many Requests. How should a junior automation test handle it?

    api
  • 73

    Several tests create users with the same email and collide. How would you generate safe test data?

    test-data
  • 74

    A test needs an order with two items before it starts. How would you set it up with SQL?

    sql
  • 75

    How would you ensure test data is cleaned up when an assertion fails halfway through a test?

    test-data
  • 76

    When is transaction rollback useful for database-backed tests?

    databasetransactionstesting
  • 77

    Four CI workers run the same tests in parallel. How would you keep their database data isolated?

    databasetesting
  • 78

    A UI test says an order was cancelled. What SQL check would you use to confirm the persisted state?

    sql
  • 79

    A test passes locally but fails in GitHub Actions because a fixture file is not found. What would you inspect?

    fixturesci-cd
  • 80

    Your test command reports failures but the CI job remains green. What is the likely issue?

  • 81

    Which artifacts would you collect when a browser test fails in CI?

    debuggingartifacts
  • 82

    How would you pass a base URL and test password to a CI test job?

    passwords
  • 83

    Browser tests work with a visible browser but fail in headless CI. How would you debug the difference?

    testing
  • 84

    A flaky test is configured for five retries and usually passes on the fourth attempt. Is that acceptable?

    flakyconfig
  • 85

    How would you split a 20-minute suite in CI so pull requests get useful feedback quickly?

    feedbackcode-review
  • 86

    Tests start failing only after CI parallelism increases from one to four workers. What would you check first?

    testing
  • 87

    A CI job suddenly fails during dependency installation after a package update. How would you investigate?

    dependencies
  • 88

    A CI test job hits its 30-minute timeout with no clear failure. What would you add to diagnose it?

    resilience
  • 89

    What is the minimum setup you need to start a basic Appium test on an Android emulator?

    mobile
  • 90

    Which locator would you prefer for a mobile Login button in Appium?

    mobilelocators
  • 91

    An Appium test can see the native app shell but not fields inside an embedded web page. What should it do?

    mobile
  • 92

    A mobile test passes on a clean emulator but fails on the second run because onboarding is skipped. How would you control device state?

    onboarding
  • 93

    How would you automate a mobile test that needs camera permission?

  • 94

    A mobile element is covered by the on-screen keyboard, so tapping Save fails. How would you make the test reliable?

  • 95

    A Python automation moves incoming invoices from one folder to another. How would you process files safely?

    concurrencypython
  • 96

    How would you run a report script every hour without two slow runs overlapping?

  • 97

    A process automation imports the same daily CSV twice after a restart. How would you prevent duplicates?

    concurrency
  • 98

    A monitoring script detects that an endpoint has failed three checks in a row. How would it send a webhook alert safely?

    monitoringalertingendpoints
  • 99

    What exit codes and logs should a command-line automation provide?

  • 100

    A new RPA script enters orders into a vendor portal, but the portal changes often. What manual fallback would you prepare?

    procurement