TestingTestingbeginner

Automation Testing Interview Questions

25 automation testing questions for fresher roles: what and when to automate, frameworks, POM, locators, waits, flaky tests, CI and a basic coding round, with short answers.

Published
TL;DR – Quick Answer

Automation testing interviews for freshers check four things: when automation is worth it, how test frameworks are organised, how you find elements with locators and waits, and whether you can write simple code. Prepare short answers with one example each, plus a small script you wrote yourself.

On This Page

Automation testing interview questions for freshers check whether you know when automation helps, how frameworks are organised and how a script finds elements on a page. A short coding round usually follows. This page has 25 questions with short answers, Selenium examples and one Java program that was run to confirm its output.

Selenium snippets show only the useful part of a test. They assume Selenium is set up in your project and driver is a WebDriver object.

How to answer automation testing questions

Use reason first, tool second. "I would automate the login and checkout regression tests because they run on every build. A one-time visual check I would leave manual."

Interviewers rate judgment as highly as tool knowledge. Say why you would automate something, not only how.

Pro tip: Keep one small automation project on GitHub. Most fresher interviews end with "show me something you built".

Automation basics questions

Q1. What is automation testing?

30-second answer: Automation testing uses scripts and tools to run tests and compare actual results with expected results, without a person doing each step. It is best for tests that run often, such as regression and smoke tests.

Q2. What is the difference between manual and automation testing?

Point Manual testing Automation testing
Who runs it A person A script
Best for New features, exploratory and usability checks Repeated regression, smoke and data-heavy tests
Speed on repeat runs Slow Fast
Setup cost Low Higher at the start
Finds new kinds of bugs Often Rarely, it checks known paths

30-second answer: Manual testing needs human judgment. Automation repeats known checks quickly. See manual vs automation testing for a full comparison.

Q3. When should you automate a test, and when should you not?

30-second answer: Automate tests that run often, are stable, have clear expected results or need many data sets. Do not automate tests that run once, features that change every week, or checks that need human judgment, such as how a page looks.

Automate Keep manual
Login and checkout regression One-time migration check
Smoke test on every build Exploratory testing
Same form with 50 data rows Usability and look-and-feel
API checks after each deploy Features still being redesigned

Q4. Which tests would you automate first?

30-second answer: The smoke suite first, then high-risk regression tests for the main user flows, such as login, search and payment. These give the fastest feedback for the effort. I would also start at the API level where possible, because API tests are faster and steadier.

Q5. Does automation replace manual testers?

30-second answer: No. Automation checks what someone already decided to check. People are still needed to explore, think of new risks, judge usability and decide what to automate. Automation frees time for that work.

Q6. Which automation tools do you know?

Tool Used for
Selenium Web browser automation, many languages
Playwright Web browser automation with built-in auto-waiting
Cypress Web testing in JavaScript and TypeScript
Appium Mobile app automation
Postman, REST Assured API testing
JMeter Load and performance testing

30-second answer: Name the tool you have used and one thing you did with it. Then mention one or two others you know about.

Framework questions

Q7. What is a test automation framework?

30-second answer: A framework is the structure and set of rules for writing, running and reporting tests. It covers folder layout, how test data is stored, how browsers start, how reports are made and how common steps are reused. A good framework makes tests easy to add and easy to fix.

Q8. What types of frameworks are there?

Type Idea
Linear (record and playback) Steps recorded in order, little reuse
Modular App split into reusable modules
Data-driven Same test runs with many data sets from a file
Keyword-driven Steps written as keywords such as click and enterText
Hybrid A mix, usually data-driven plus modular
BDD Tests written as Given, When, Then scenarios

30-second answer: Most real projects use a hybrid framework with the Page Object Model, a test runner, external test data and reports.

Q9. What is a data-driven test?

30-second answer: The same test logic runs with different input rows from a file, sheet or data provider. In TestNG, a @DataProvider method supplies the rows.

@DataProvider(name = "logins")
public Object[][] logins() {
    return new Object[][] {
        {"asha@example.com", "Valid@123", true},
        {"asha@example.com", "wrong", false}
    };
}

@Test(dataProvider = "logins")
public void loginTest(String email, String password, boolean shouldPass) {
    // open the login page, enter values, then check the result
}

Q10. What is BDD?

30-second answer: Behaviour-Driven Development describes behaviour in plain language that business people can read. Scenarios use the Gherkin format, and tools such as Cucumber link each line to code.

Feature: Login
  Scenario: Valid user logs in
    Given the user is on the login page
    When the user enters a valid email and password
    Then the dashboard is shown

Q11. What is the Page Object Model?

30-second answer: The Page Object Model keeps the locators and actions of each page in its own class. Tests call methods such as loginPage.login(email, password) instead of finding elements directly. When the page changes, you fix one class instead of every test.

public class LoginPage {
    private final WebDriver driver;
    private final By email = By.id("email");
    private final By password = By.id("password");
    private final By submit = By.cssSelector("button[type='submit']");

    public LoginPage(WebDriver driver) { this.driver = driver; }

    public void login(String user, String pass) {
        driver.findElement(email).sendKeys(user);
        driver.findElement(password).sendKeys(pass);
        driver.findElement(submit).click();
    }
}

Q12. What does a test runner do?

30-second answer: A test runner finds and runs tests, handles setup and teardown, groups tests and reports results. TestNG and JUnit are common for Java, pytest for Python, and Playwright Test for Playwright. Assertions inside the test decide pass or fail.

Locator and wait questions

Q13. What is a locator? Which types does Selenium support?

30-second answer: A locator tells the tool how to find an element. Selenium supports id, name, class name, tag name, link text, partial link text, CSS selector and XPath. Selenium 4 also has relative locators, such as finding an element above another.

Q14. Which locator do you prefer and why?

30-second answer: A unique id or a test attribute such as data-test, because they rarely change. Next, a short CSS selector. I use XPath when I need text or a parent element. I avoid long paths based on page layout, because a small design change breaks them.

Q15. What is the difference between absolute and relative XPath?

30-second answer: Absolute XPath starts from the root with a single slash and lists every level, such as /html/body/div[2]/form/input[1]. Relative XPath starts with // and finds the element from anywhere, such as //input[@id='email']. Relative XPath is much less fragile.

Q16. Give some CSS selector examples.

Selector Finds
#email Element with id email
.btn-primary Elements with that class
input[name='q'] Input with name q
button[data-test='save'] Button with that test attribute
form > input Inputs that are direct children of a form

Q17. Why should you use waits instead of Thread.sleep?

30-second answer: Pages load at different speeds. Thread.sleep(5000) always waits five seconds, which slows every run and still fails if the page takes six. An explicit wait checks a condition, such as "button is clickable", and continues as soon as it is true.

WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
wait.until(ExpectedConditions.elementToBeClickable(By.id("pay"))).click();

Playwright waits automatically before most actions, as the Playwright interview questions page explains.

Basic scripting questions

Q18. Write a basic Selenium test that opens a page and checks the title.

30-second answer: Start the browser, open the URL, check the title and always quit.

from selenium import webdriver

driver = webdriver.Chrome()
try:
    driver.get("https://example.com")
    assert "Example Domain" in driver.title
finally:
    driver.quit()

Current Selenium versions include Selenium Manager, which can find or download a suitable browser driver when none is set up.

Q19. What is the difference between hard and soft assertions?

30-second answer: A hard assertion stops the test as soon as it fails. A soft assertion records the failure and lets the test continue, then reports all failures at the end. TestNG's SoftAssert needs assertAll() at the end, or failures are not reported.

Q20. Which simple programs are asked in automation interviews?

30-second answer: Reverse a string, check a palindrome, count vowels, find duplicates in an array, find the largest number, and swap two numbers. Here is one program that covers three of them.

public class ReverseWords {
    public static void main(String[] args) {
        String text = "automation testing";
        String reversed = new StringBuilder(text).reverse().toString();
        System.out.println(reversed);

        String word = "level";
        boolean isPalindrome = word.equals(new StringBuilder(word).reverse().toString());
        System.out.println(word + " is palindrome: " + isPalindrome);

        int vowels = 0;
        for (char ch : text.toCharArray()) {
            if ("aeiou".indexOf(ch) >= 0) {
                vowels++;
            }
        }
        System.out.println("Vowels: " + vowels);
    }
}

Output:

gnitset noitamotua
level is palindrome: true
Vowels: 8

Practise writing these without built-in helpers too, for example with a loop. A loop version compares characters from both ends and stops at the middle.

Working-style questions

Q21. What is a flaky test, and how do you fix it?

30-second answer: A flaky test passes and fails on different runs without any code change. Common causes are missing waits, shared test data, test order dependence and unstable environments. Fix the cause: add proper waits, give each test its own data and make tests independent. Do not just add retries and move on.

Q22. What is the test automation pyramid?

30-second answer: The pyramid says to have many fast unit tests at the bottom, fewer API or service tests in the middle, and a small number of UI tests at the top. UI tests are slow and break more easily, so they should cover only key user flows. The API testing interview questions page covers the middle layer.

Q23. How does automation fit into CI?

30-second answer: In continuous integration, every code push triggers a build and runs automated tests on a tool such as Jenkins, GitHub Actions or GitLab CI. Smoke tests run on every push, and the full regression suite may run nightly. A failed test blocks or flags the change early.

Q24. How do you report results and debug failures?

30-second answer: I use the runner's report, such as a TestNG or Allure report, and take a screenshot when a test fails. Logs and the failing step help me decide whether it is a product bug, a test bug or an environment problem before I log anything.

Q25. How do you manage test data?

30-second answer: Keep test data out of the code, in files or a data provider. Create fresh data for each test where possible, for example through an API call in setup, and clean it up after. Never depend on data another test created, and never put real customer data in test files.

How to prepare in two weeks

Days Task
1 to 3 Core language basics and the simple programs above
4 to 6 Locators, waits and a first script
7 to 9 Page Object Model and a test runner
10 to 11 Data-driven tests and reports
12 Run tests from the command line or CI
13 to 14 Revise and do mock interviews

Review test design with manual testing interview questions, because many automation rounds still start there. Questions on where testing fits in a project are covered in SDLC and STLC interview questions. When you are comfortable with these basics, move to the deeper Selenium interview questions.

Frequently Asked Questions

Which language should a fresher learn for automation testing?
Pick the language used in the jobs you are applying for. Java is very common with Selenium in Indian service companies. Python and JavaScript or TypeScript are also widely used, especially with Playwright. One language learned well is better than three learned partly.
Can a fresher get an automation testing job without manual testing experience?
Yes, but you still need testing basics. Interviewers expect you to write good test cases, understand the bug life cycle and know what to automate. Automation is a way to run tests, not a replacement for test design.
Which tool should I learn first, Selenium or Playwright?
Both are good. Selenium has a long history and appears in many job posts. Playwright is newer, has auto-waiting built in and is growing fast. Check the job posts you are targeting, learn one well and understand the ideas that carry over, such as locators and waits.
How much coding is asked in automation testing interviews?
Fresher rounds usually ask simple programs: reverse a string, check a palindrome, count characters, find duplicates in an array, and basic OOP questions. You should also read and explain a short test script.
What project should I show for an automation testing interview?
Automate five to ten tests on a public practice site using the Page Object Model, a test runner, waits, a report and screenshots on failure. Put it on GitHub with a clear README so the interviewer can see how you organise code.
Siva Prasad Galaba
Founder, CodeBegun · Staff Engineer

Founder of CodeBegun. 15+ years building Java systems at companies like Crunchyroll. Teaches Java, Spring Boot and system design the way the industry actually works, and mentors students through projects, mock interviews and placement preparation.

Technically reviewed by CodeBegun Technical TeamLast reviewed 4 December 2026 LinkedIn
Chat with us