These Infosys test automation interview questions reflect what candidates with roughly 2–8 years of experience report from recent technical rounds: project and framework design, core Java, TestNG, Selenium element handling, API and Postman checks, Agile and testing concepts, two short coding problems and an HR discussion. Answers are short, practical and current for 2026 (Selenium 4, Java 17/21). For the older combined set, see Cognizant and Infosys interview questions.

Technical Round

1. Explain your project and your roles and responsibilities.

Describe the application in one sentence (domain and users), the team and sprint setup, then your responsibilities in order: requirement analysis, test design, manual and automation execution, API and database checks, defect management and CI. Finish with one measurable result, for example cutting regression time from two days to four hours by automating 300 cases.

2. Have you built a framework from scratch? How did you design it?

Explain the decisions, not just the folders: Selenium with Java and TestNG, Maven, Page Object Model with a BasePage, a driver factory with ThreadLocal for parallel runs, configuration per environment, data from JSON or Excel, Extent or Allure reports with screenshots on failure, and Jenkins jobs triggered on merge and nightly. See how to explain your framework.

3. Comparable vs Comparator?

Comparable defines a class's natural order inside the class (compareTo, one ordering). Comparator defines an ordering outside the class (compare), so you can have many, for example sorting products by price or by name in a test: products.sort(Comparator.comparing(Product::price)).

4. When do you use the finally block?

For cleanup that must run whether or not an exception occurs: closing files, database connections or the browser. In modern Java prefer try-with-resources for anything AutoCloseable; in TestNG use @AfterMethod(alwaysRun = true) to quit the driver.

5. Scrum vs Kanban?

Scrum works in fixed sprints with defined roles and ceremonies (planning, daily stand-up, review, retrospective) and commits to a sprint backlog. Kanban is continuous flow: work items move across a board with work-in-progress limits and no fixed iterations. Many QA teams in support or maintenance projects use Kanban; product teams mostly use Scrum.

6. Smoke vs sanity, and regression vs retesting?

Smoke: broad, shallow check that a build is stable. Sanity: narrow check that a specific change works. Retesting: re-running the failed test to confirm a specific bug is fixed. Regression: re-running wider tests to confirm the fix or change didn't break anything else.

7. How do you take screenshots only for failed tests in TestNG?

Implement ITestListener, capture the screenshot in onTestFailure from the current thread's driver, attach it to the report and register the listener in testng.xml. See TestNG listeners.

8. If 49 of 200 tests fail, how do you get only the failed ones?

TestNG writes testng-failed.xml in the output folder after a run; run that file to execute only the failures. Reports (Extent, Allure, emailable-report) also list them, and a RetryAnalyzer can retry flaky failures automatically.

9. What is the Maven Surefire plugin used for?

It runs the tests during mvn test. You configure it with the testng.xml suite files, include and exclude patterns, groups, system properties and parallel settings, and it writes XML reports that Jenkins publishes.

10. How do you do data-driven testing in Postman?

Use variables such as {{email}} in the request, then run the collection in the Collection Runner or Newman with a CSV or JSON data file; each row is one iteration. See Postman interview questions.

11. What do you check when testing an API?

Status code, response body and schema, data correctness against the request and the database, headers, error messages for invalid input, authentication and authorisation, response time, and behaviour on retries and edge cases. See the API testing checklist.

12. How do you decide which test cases to automate?

Automate stable, repeated, high-value tests: smoke and regression suites, data-driven cases and cross-browser checks. Avoid one-off tests, frequently changing UI, exploratory and usability testing, and cases where automation costs more than it saves.

13. How do you switch to a frame and back?

driver.switchTo().frame("paymentFrame");                 // by name/id, index or WebElement
driver.findElement(By.id("cardNumber")).sendKeys("4111111111111111");
driver.switchTo().parentFrame();                           // one level up
driver.switchTo().defaultContent();                        // back to the main page
List<String> urls = driver.findElements(By.cssSelector("#menu a")).stream()
        .map(a -> a.getAttribute("href")).toList();      // collect first: navigating makes elements stale
for (String url : urls) {
    driver.navigate().to(url);
    System.out.println(url + " -> " + driver.getTitle());
}

15. What is a NullPointerException?

A runtime exception thrown when code uses a reference that points to no object, for example calling a method on an uninitialised WebDriver or on a value missing from a map. Prevent it by initialising fields, checking for null where values may be absent, and using Optional for optional results.

16. driver.get() vs driver.navigate().to()?

Both load a URL and wait according to the page load strategy. navigate() also offers back(), forward() and refresh().

17. How do you handle a location permission pop-up?

It's a browser permission prompt, not an HTML element, so Selenium can't click it. Set the permission before the session starts:

ChromeOptions o = new ChromeOptions();
o.setExperimentalOption("prefs", Map.of("profile.default_content_setting_values.geolocation", 1));  // 1 allow, 2 block
WebDriver driver = new ChromeDriver(o);

18. How do you handle dynamic dropdowns (auto-suggest)?

Type part of the value, wait for the suggestion list, then pick the option by text rather than position:

driver.findElement(By.id("city")).sendKeys("Ben");
new WebDriverWait(driver, Duration.ofSeconds(5))
    .until(ExpectedConditions.elementToBeClickable(By.xpath("//li[normalize-space()='Bengaluru']"))).click();

19. Default vs public access modifier?

Public members are visible everywhere. Default (no modifier, package-private) members are visible only within the same package, which is useful for helpers that tests in other packages shouldn't use.

20. What is method hiding in Java?

When a subclass declares a static method with the same signature as a static method in its parent. The method called depends on the reference type at compile time, not the object at run time, so it isn't overriding: Parent p = new Child(); p.show(); calls Parent.show() if show is static.

21. Print array elements that appear two or more times.

int[] arr = {4, 2, 7, 2, 4, 4, 9};
Map<Integer, Integer> count = new LinkedHashMap<>();
for (int n : arr) count.merge(n, 1, Integer::sum);
count.forEach((k, v) -> { if (v >= 2) System.out.println(k + " appears " + v + " times"); });

22. Print each word in a sentence with its character count.

String sentence = new Scanner(System.in).nextLine();
for (String word : sentence.trim().split("\\s+")) {
    System.out.println(word + " - " + word.length());
}
Advertisement

HR Round

23. Why do you want to change your current job?

Keep it positive and forward-looking: broader automation work, a new domain, larger systems or growth into framework ownership. Never criticise your current employer.

24. What are your salary expectations?

Give a researched range based on your experience, skills and current market rates for the role and city, and say you're open to discussing the full package.

How to Prepare

FAQs

What does the Infosys automation testing interview cover?

Typically a technical round on your project, framework, Java, TestNG, Selenium and API testing with one or two coding problems, followed by a managerial or HR round.