QA Automation Interview Questions: Technical & Techno-Managerial Rounds

Real two-round QA automation interview questions with short, simple answers: Java, SQL, Selenium, TestNG, Cucumber, Postman, JMeter and team scenarios.

Round 1: Technical

1. Explain about yourself and your roles and responsibilities.

Use Present → Past → Future, in under 2 minutes. A typical answer for 8+ years of experience:

  • Present: current role, domain, and tech stack (Selenium, Java, TestNG, Cucumber, Postman, CI/CD).
  • Past: frameworks built, API and regression coverage added, time saved, juniors mentored.
  • Responsibilities: test strategy, framework design, code reviews, regression in CI/CD, defect triage, and reporting to stakeholders.
  • Future: why this role is the next step.

2. Write Java code to reverse a string while preserving the whitespace.

Reverse only the non-space characters and keep the spaces at their original positions.

static String reverse(String s) {
    char[] c = s.toCharArray();
    int i = 0, j = c.length - 1;
    while (i < j) {
        if (c[i] == ' ') i++;
        else if (c[j] == ' ') j--;
        else { char t = c[i]; c[i++] = c[j]; c[j--] = t; }
    }
    return new String(c);
}
// "ab cd" -> "dc ba"

3. Given an SQL table, find the second-largest salary of an employee.

SELECT MAX(salary) FROM employee
WHERE salary < (SELECT MAX(salary) FROM employee);
-- or: SELECT DISTINCT salary FROM employee ORDER BY salary DESC LIMIT 1 OFFSET 1;

4. Explain the concept of joins and list the different types of joins available.

A join combines rows from two or more tables based on a related column.

  • INNER JOIN: only matching rows.
  • LEFT JOIN: all rows from the left table, plus matches from the right.
  • RIGHT JOIN: all rows from the right table, plus matches from the left.
  • FULL JOIN: all rows from both tables.
  • CROSS JOIN: every row paired with every row (cartesian product).
  • SELF JOIN: a table joined with itself.

5. What is LinkedHashMap? Explain its use.

A HashMap that also keeps insertion order (via a linked list). Use it when you need fast lookups and predictable iteration order, e.g. an LRU cache or reading config in the order it was added.

6. Explain black-box testing and white-box testing.

  • Black-box: test inputs and outputs without knowing the code (functional, UI, API tests). Done by QA.
  • White-box: test internal code, logic, and branches (unit tests, code coverage). Usually done by developers.

7. What is the difference between an exception and an error?

An exception is a problem the program can handle (e.g. IOException, NullPointerException) using try/catch. An error is a serious JVM-level problem you usually can’t recover from (e.g. OutOfMemoryError, StackOverflowError).

8. Difference between findElement and findElements.

  • findElement returns the first matching WebElement and throws NoSuchElementException if none is found.
  • findElements returns a List of all matches and returns an empty list if none is found (no exception).

9. What is the difference between implicit wait and explicit wait?

  • Implicit: a global wait applied to every findElement call.
  • Explicit: waits for a specific condition on a specific element (e.g. clickable, visible).
new WebDriverWait(driver, Duration.ofSeconds(10))
    .until(ExpectedConditions.elementToBeClickable(By.id("btn")));

Avoid mixing the two.

10. Write Selenium code to automate a calendar WebElement.

Open the calendar, then pick the date cell by its text.

driver.findElement(By.id("datepicker")).click();
driver.findElement(By.xpath("//td[@data-date='15']")).click();
// If the input is a plain text field, just: element.sendKeys("15/08/2026");

For month/year, click the “next” button in a loop until the header text matches.

11. How would you fetch the text from a text box in Selenium?

getText() doesn’t work on input fields. Use the value attribute.

String text = driver.findElement(By.id("name")).getAttribute("value");

12. How do you enter text in an alert using Selenium?

Alert alert = driver.switchTo().alert();
alert.sendKeys("hello");
alert.accept();

Works only for prompt alerts.

13. What is the difference between checked and unchecked exceptions?

  • Checked: checked at compile time; you must handle or declare them (IOException, SQLException).
  • Unchecked: happen at runtime; handling is optional (NullPointerException, ArrayIndexOutOfBoundsException). They extend RuntimeException.

14. If an XPath selects two elements on a webpage, does findElement throw an exception?

No. findElement returns the first matching element. It throws only when there is no match.

15. Explain smoke testing and sanity testing.

  • Smoke: a quick, broad check on a new build to see if the main features work (build is stable enough to test further).
  • Sanity: a narrow check after a small change or bug fix to confirm that specific area works.

16. What are relative locators in Selenium?

Selenium 4 feature to find elements by their position relative to other elements: above, below, toLeftOf, toRightOf, near.

driver.findElement(with(By.tagName("input")).below(By.id("username")));

17. Explain the challenges you faced in your project.

Common challenges and fixes:

  • Flaky tests (dynamic elements, timing): explicit waits, stable locators, limited retry.
  • Test data: create data through APIs or reset it before each run.
  • Slow regression: run in parallel, split into smoke and full suites.
  • Unstable environments: health checks before runs, mock unstable services.
  • Changing requirements: keep tests modular so updates are cheap.

18. How would you pick test cases for regression testing?

Pick:

  • High-risk and business-critical flows (login, payment).
  • Areas touched by the change and their dependencies.
  • Test cases that found bugs before.
  • Stable, repeatable cases that can be automated. Skip rarely-used and low-risk cases.

Round 2: Techno-Managerial

1. Explain your framework in detail.

A common setup is a hybrid framework: Java + Selenium + TestNG + Cucumber, built with Maven.

  • Page Object Model for pages.
  • Base class for driver setup/teardown.
  • Config/properties file for URL, browser, credentials.
  • Utilities for waits, data reading (Excel/JSON), logging.
  • Cucumber feature files + step definitions.
  • Reports: Extent/Allure. Run through Jenkins/CI.

2. In your framework, if you have 100 pages, do you create 100 Page Objects?

Not necessarily. One Page Object per page or per reusable component (header, footer, menu). Pages that are very similar can share a base page or component class. Don’t duplicate code.

3. What is an “Element click intercepted” exception, and how do you fix it?

Another element (popup, overlay, sticky header, loader) covers the target, so the click lands on the wrong element. Fix: wait for the overlay to go away, scroll the element into view, or as a last resort use JavaScript click.

((JavascriptExecutor) driver).executeScript("arguments[0].click();", element);

4. How do you take screenshots for failed test cases only in TestNG?

Use an ITestListener and take the screenshot in onTestFailure.

public void onTestFailure(ITestResult result) {
    File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
    FileUtils.copyFile(src, new File("screenshots/" + result.getName() + ".png"));
}

5. Explain how to connect your test cases with Azure.

Azure DevOps: create a pipeline (azure-pipelines.yml) that runs mvn test on each commit. Publish the results with the PublishTestResults task so they show in Azure Test Plans/Pipelines. Map automated tests to Test Cases using the test case ID (or the Azure Test Plans API).

6. What is the get fetch command?

Most likely this means driver.get(). driver.get(url) opens a URL and waits for the page to load fully. Different from driver.navigate().to(url), which also supports back/forward/refresh. If you meant “fetch” in JavaScript: fetch(url) makes an HTTP request and returns a Promise.

7. In Postman, how do you delete a variable after test execution is finished?

In the Tests script:

pm.environment.unset("token");   // environment variable
pm.globals.unset("token");       // global variable
pm.collectionVariables.unset("token");

8. Why do you prefer using Cucumber BDD in your project?

Tests are written in plain English (Given/When/Then), so BA, devs, and QA all understand them. It acts as living documentation, improves collaboration, and makes steps reusable.

9. Explain dynamic binding and static binding.

  • Static (compile-time): method is decided at compile time. Used for overloading, private, static, and final methods.
  • Dynamic (runtime): method is decided at runtime based on the object’s actual type. Used for overriding.
Animal a = new Dog(); a.sound(); // calls Dog's sound() (dynamic)

10. What is method overloading, and what is method overriding?

  • Overloading: same method name, different parameters, in the same class (compile-time).
  • Overriding: a child class gives its own version of a parent method with the same signature (runtime).

11. What is the difference between Comparable and Comparator?

  • Comparable: natural ordering, defined inside the class (compareTo). One way to sort.
  • Comparator: custom ordering, defined outside the class (compare). Many ways to sort.
list.sort(Comparator.comparing(Employee::getSalary));

12. How would you conclude that a login page is user-friendly?

Check that:

  • Labels and placeholders are clear; the layout is simple.
  • Error messages are helpful (e.g. “Wrong password”, not “Error”).
  • Tab order and Enter-key submit work.
  • Show/hide password, “Forgot password”, and “Remember me” exist.
  • Works on mobile and in different browsers; loads fast; is accessible.

13. What are 5 points you consider when writing a good test case?

1. Clear, unique ID and title.

2. Preconditions and test data.

3. Simple, step-by-step actions.

4. Clear expected result.

5. Independent, repeatable, and traceable to a requirement.

14. Suppose a developer is not fixing a bug; how would you approach the situation?

First, check that the bug is clear and reproducible (steps, logs, screenshots). Talk to the developer to understand why (not a bug? low priority? blocked?). Explain the business impact and severity. If it’s still not fixed, raise it with the lead/product owner so they decide the priority. Stay factual and polite.

15. What are threads in JMeter?

Threads are virtual users. Each thread runs the test plan independently and simulates one user. Thread Group settings: number of threads (users), ramp-up period, and loop count.

16. Can you automate captchas?

No, captchas are designed to block automation. Don’t automate them. Instead: ask developers to disable or bypass the captcha in the test environment, use a test key/fixed code, or mock the captcha response.