Skip to content

Infosys Interview Prep β€” IQE API Testing (JL5, 5–10 yrs)

Role: Speed Hiring – Infosys Quality Engineering – API Testing – JL5 Job ID: INFSYS-EXTERNAL-242009 Β· Bangalore Interview date: 2026-06-25 (day after tomorrow) Core skills they will test: Selenium + Java, Java OOPs/Collections/Exceptions, REST Assured (API automation), SQL, BDD (Cucumber), CI/CD, Agile, test design, leadership.

How to use this file: Read top to bottom once. Then re-read the bold one-line answers the night before. In the interview, answer the bold line first, then add one example from your own projects. Simple, confident, short.

πŸ“ The πŸ“ In my project: callouts point to real, passing code in the selenium-restassured-practice/ repo (30 tests green on Java 25). When an interviewer says "give an example," name the concept, then quote the file β€” e.g. "I do that in RestfulBookerCrudTest β€” POST /auth, extract the token, then chain it through the CRUD calls." That specificity is what proves real experience.


0) Quick "Tell me about yourself" (say this in 60 seconds)

"I'm a QA / automation engineer with hands-on experience in two frameworks. First, a Java framework using Selenium 4, TestNG, REST Assured and Maven with Page Object Model and ExtentReports β€” I use this for both UI and API automation. Second, a Playwright + TypeScript framework integrated with Jenkins CI. I also do API testing with REST Assured and Postman, write SQL to validate data in the backend, and follow BDD with Cucumber. I work in Agile, raise and track defects in JIRA, and I've led/mentored a small team in an onsite-offshore model."

Keep it factual. They like honesty about what you'd improve next ("tech-debt awareness").


1) API Testing & REST Assured ⭐ (most important β€” this is the role)

Q1. What is API testing and why is it important? API testing checks the business logic and data directly at the service layer, without the UI. It is faster, more stable, and catches bugs earlier than UI tests. You send a request to an endpoint and check the response.

πŸ“ In my project: my whole api/ package tests services with no browser β€” e.g. RestfulBookerCrudTest.java hits the Restful-Booker booking service directly and the API suite runs in seconds vs minutes for UI.

Q2. REST vs SOAP? - REST = lightweight, uses HTTP, supports JSON/XML, stateless, faster, most common today. - SOAP = strict protocol, only XML, has WSDL, heavier, used in banking/legacy where strong contracts/security are needed. One line: REST is flexible and fast; SOAP is strict and secure.

Q3. HTTP methods β€” explain CRUD. - POST β†’ Create, GET β†’ Read, PUT β†’ Update (full), PATCH β†’ Update (partial), DELETE β†’ Delete.

πŸ“ In my project: RestfulBookerCrudTest.java uses all five in one chain β€” POST /booking (L68), GET /booking/{id} (L87), PUT (L108), PATCH (L127), DELETE (L140).

Q4. Can we use POST to update a resource? Technically yes, but it's wrong practice. PUT/PATCH are meant for update; POST is for create. POST is not idempotent (calling it twice creates two records).

Q5. Idempotent methods? Same call many times = same result. GET, PUT, DELETE are idempotent. POST is not.

Q6. Important status codes (know these cold): | Code | Meaning | |------|---------| | 200 | OK (success) | | 201 | Created | | 204 | No Content (success, no body β€” e.g. after DELETE) | | 301 | Moved permanently | | 400 | Bad Request (client sent wrong data) | | 401 | Unauthorized (not logged in / bad token) | | 403 | Forbidden (logged in but no permission) | | 404 | Not Found | | 429 | Too Many Requests (rate limit hit) | | 500 | Internal Server Error (server bug) | | 503 | Service Unavailable |

Infosys has asked specifically about 429 β€” say: "It means the client sent too many requests in a short time and hit the rate limit; the API throttles it."

Q7. What validations do you put on an API response? (very common) 1. Status code (e.g. 200/201) 2. Response body β€” field values, correct data 3. Schema validation β€” structure/data types match the contract (JSON schema) 4. Headers β€” content-type, auth headers 5. Response time (performance) 6. Negative cases β€” wrong/missing data returns 400/401/404

πŸ“ In my project: RestfulBookerCrudTest.java:70-72 checks status 200 + body fields + time(lessThan(5000L)) in one .then(); SchemaValidationTest.java:23 does schema validation; JsonPlaceholderTest.java:81 is the negative 404 case.

Q8. Sample REST Assured code (be ready to write this):

given()
    .baseUri("https://api.example.com")
    .header("Authorization", "Bearer " + token)
    .contentType(ContentType.JSON)
    .body(requestPayload)
.when()
    .post("/users")
.then()
    .statusCode(201)
    .body("name", equalTo("Dheeraj"))
    .body("id", notNullValue())
    .time(lessThan(2000L));
Structure to remember: given() β†’ when() β†’ then() (setup β†’ action β†’ assert). This is BDD style built into REST Assured.

πŸ“ In my project: real working version in RestfulBookerCrudTest.java:56-79 β€” createBooking() sends a Java record as the body and asserts status + booking.firstname + response time.

Q9. How do you extract a value from a response (e.g. token, id)?

String token = given().body(loginPayload)
    .when().post("/login")
    .then().extract().path("access_token");
Use .extract().response() to get the full response, or .path("...") for one field. Then pass it to the next request.

πŸ“ In my project: RestfulBookerCrudTest.java:43-54 β€” createToken() does .extract().path("token"), then every write call reuses it via .header("Cookie", "token=" + token). That's real token chaining.

Q10. How do you do data-driven API testing? - In REST Assured: use TestNG @DataProvider or read from Excel/CSV/JSON and loop. - In Postman: use a CSV/JSON data file in Collection Runner, with {{variables}}.

πŸ“ In my project: @DataProvider "invalidCredentials" in LoginTest.java:30-46 feeds 3 credential sets into one test β€” same technique applies to API tests.

Q11. JSON schema validation in REST Assured?

.then().assertThat()
.body(matchesJsonSchemaInClasspath("user-schema.json"));
(Needs the json-schema-validator dependency.) It checks the response structure and types, not just values.

πŸ“ In my project: SchemaValidationTest.java:23 validates GET /booking against booking-ids-schema.json. Real gotcha I hit: the correct import is io.restassured.module.jsv.JsonSchemaValidator (not jsonschema).

Q12. How do you handle authentication / authorization in API tests? - Basic Auth β€” username/password. - Bearer token / OAuth 2.0 β€” get a token from a login/token endpoint, then send it in the Authorization: Bearer <token> header on every request. - API key β€” sent in header or query param.

πŸ“ In my project: RestfulBookerCrudTest.java:105 β€” I get a token from POST /auth then send it on every write. (Restful-Booker takes the token as a Cookie: token=...; the pattern β€” auth call β†’ token β†’ attach to later requests β€” is identical to Bearer.)

Q13. Explain OAuth 2.0 (simple). It's a way to give an app limited access without sharing your password. You log in, an authorization server gives an access token, and the app uses that token to call the API. Common grant types: Authorization Code, Client Credentials, Password.

Q14. What is a JWT? (asked by Infosys) JWT = JSON Web Token. A signed token with 3 parts: Header.Payload.Signature. - Header = algorithm/type. - Payload = the data/claims (user id, roles, expiry). - Signature = ensures the token wasn't tampered with. It is self-contained (server doesn't need to store session) and stateless.

Q15. What is a Bearer token? "Whoever holds (bears) this token can access the API." It's sent in the header: Authorization: Bearer <token>. So it must be kept secret.

Q16. POST vs PUT (one line) β€” POST creates a new resource; PUT updates/replaces an existing one (and is idempotent).

πŸ“ In my project: POST creates the booking (L68); PUT replaces all fields of that same booking (L108); PATCH changes just firstname (L127).

Q17. Why use Kibana if Postman console shows logs? (Infosys asked) Postman console only shows your single request/response on your machine. Kibana shows centralized server-side logs across all services and users in real time β€” useful to debug what happened on the backend, errors, and trends. Different purpose.

Q18. How do you test an API end-to-end with the DB? Send the API request β†’ validate the response β†’ then run a SQL query to confirm the data was actually written/updated correctly in the database. (This is where SQL skills come in.)


2) Java β€” OOPs, Collections, Exceptions (JD asks this explicitly)

Q19. Explain OOPs concepts (link to your framework). - Encapsulation β€” wrap data + methods together, use private fields + getters/setters. (In my framework, page classes hide locators behind methods.) - Inheritance β€” child reuses parent. (BaseTest/BasePage holds common setup.) - Polymorphism β€” same method behaves differently. Overloading (compile-time) + overriding (run-time). (WebDriver reference pointing to ChromeDriver/FirefoxDriver.) - Abstraction β€” hide complexity, show only what's needed. (Interfaces, abstract base classes.)


2A) "Which version / where did you use it" questions β€” answer with YOUR project (Infosys asks these)

These are experience questions. The trick: name the version, give 2–3 features, then immediately point to where you used it in your own framework (B2B/Avysh Java + Selenium 4 + TestNG + REST Assured framework, or the Playwright + TypeScript one). Be concrete.

Q19a. Which version of Java are you using? What are its features? (asked to you last time) "I'm using Java 25 β€” it's the latest LTS (Long Term Support) release." Then lead with the features you actually use in the framework (this is what makes the answer believable β€” be ready to explain any you name):

Daily workhorses (from Java 8, still the most-used): 1. Lambda expressions β€” short inline functions. I use them in custom waits and stream operations. 2. Stream API β€” filter/map/collect on collections. I use it to filter web elements and process API response lists. 3. Functional interfaces (Predicate, Function, Supplier). 4. Optional β€” avoid NullPointerException. 5. New Date/Time API (LocalDate, LocalDateTime).

Modern features I use (Java 11 β†’ 25): 6. var β€” local variable type inference (cleaner code). 7. Records β€” for immutable POJOs / DTOs (e.g. API request & response objects in REST Assured). 8. Text blocks ("""...""") β€” multi-line JSON request bodies in REST Assured without escaping quotes (very practical for API tests). 9. Switch expressions β€” concise mapping (e.g. status code β†’ message). 10. Pattern matching for instanceof β€” cleaner casting, no extra cast line.

Newest (Java 21 β†’ 25 LTS) β€” mention as "also available to me": 11. Virtual threads (Java 21) β€” lightweight threads for high-concurrency / parallel runs. 12. Sequenced collections (Java 21) β€” first/last access on lists/sets. 13. Scoped values & module import declarations (Java 25) β€” newer additions in the latest LTS.

How to say it in one breath: "I'm on Java 25, the latest LTS. Day to day I mostly use lambdas and streams, var, records for my API POJOs, and text blocks for JSON payloads in REST Assured. I also have newer things like virtual threads available."

⚠️ Defensibility rule: only name a feature if you can give a one-line use case. Records (POJOs) and text blocks (JSON bodies) are your strongest, most practical examples for an automation role β€” lean on those. If pushed on virtual threads/scoped values, it's fine to say "I'm aware of them but haven't needed them in test automation yet."

πŸ’‘ Backward compatibility: Java 25 runs everything from older versions β€” so all the Java 8 examples in this doc are valid on your setup. LTS versions (the "safe enterprise" ones) are 8, 11, 17, 21, 25.

Q19b. Show where you used the Stream API / lambda in your project.

// Filtering web elements with a stream + lambda
List<WebElement> links = driver.findElements(By.tagName("a"));
List<String> hrefs = links.stream()
        .map(e -> e.getAttribute("href"))
        .filter(h -> h != null && !h.isEmpty())
        .collect(Collectors.toList());

// Explicit wait uses a lambda (Function) under the hood
wait.until(d -> d.findElement(By.id("login")).isDisplayed());
"I used streams in my broken-link checker and lambdas in my custom waits and TestNG data filtering."

πŸ“ In my project: stream + lambda in BrokenLinksTest.java:27-32 and ProductsPage.java:44-46; lambda-backed fluent wait in WaitsTest.java:43-49.

Q19c. Where exactly did you use each OOPs concept in your project? (asked to you last time) Say it as a story β€” one concrete place per concept: - Encapsulation: "My page classes keep locators private and expose only public action methods like login(user, pass). The test never touches a raw locator β€” that's encapsulation." - Inheritance: "Every test class extends a BaseTest that handles driver setup/teardown in @BeforeMethod/@AfterMethod, and every page extends a BasePage with common helpers (click, type, waitFor). So I write setup once." - Polymorphism: - Overriding: "I override toString() in my POJOs, and override TestNG listener methods like onTestFailure()." - Overloading: "My utility has overloaded click() β€” one takes a By, another takes a WebElement and a wait time." - Runtime polymorphism: "WebDriver driver = new ChromeDriver(); β€” the parent reference points to a child object; I can swap Chrome/Firefox via config." - Abstraction: "WebDriver itself is an interface β€” I code to the interface, not the browser. I also have an abstract BasePage that defines the structure all pages follow."

Exact file:line proof (from my selenium-restassured-practice project β€” quote these if pushed): | Concept | Where in code | |---|---| | Encapsulation | pages/LoginPage.java:14-17 β€” private final By locators, public loginAs() | | Inheritance | base/BaseTest.java:14 (tests extend it), pages/BasePage.java:16 β†’ LoginPage/ProductsPage, api/BaseApiTest.java:13 | | Overloading | pages/BasePage.java:37 & 41 β€” click(By) and click(WebElement) | | Runtime polymorphism | base/DriverFactory.java:28-39 β€” WebDriver ref β†’ ChromeDriver/FirefoxDriver chosen at runtime from config | | Abstraction | abstract BaseTest/BasePage/BaseApiTest; coding to the WebDriver interface | | Implementing an interface | utils/ScreenshotListener.java:19 (ITestListener), RetryAnalyzer.java:10 (IRetryAnalyzer), RetryListener.java:13 (IAnnotationTransformer) |

One-liner: Encapsulation β†’ private locators; Inheritance β†’ Base classes; Polymorphism β†’ overloaded click() + WebDriver interface ref; Abstraction β†’ abstract bases + coding to interfaces.

Q19d. Why did you choose Page Object Model? (follow-up they love) "To reduce duplication and make maintenance easy." If a locator changes, I fix it in one page class, not in 50 tests. It separates test logic from page details β€” readable and reusable. (POM is itself an example of encapsulation + abstraction.)

Q19e. Which Selenium version and what's new in it? "Selenium 4." New: W3C protocol (stable), relative locators (above/below/near), native Chrome DevTools access, improved newWindow() for tabs/windows, better Grid. (Same as Q38 β€” say it the same way.)

Q19f. Which TestNG features do you use and why? Annotations + execution order, @DataProvider for data-driven, groups (smoke/regression), parallel execution, dependsOnMethods, IRetryAnalyzer for flaky tests, ITestListener for fail-only screenshots. (See Q73l.)

Q19g. Which build tool and how do you manage dependencies? "Maven." pom.xml declares Selenium, REST Assured, TestNG; Maven downloads them; Surefire runs mvn test β€” which is what Jenkins calls in the pipeline. (See Q73n.)

Q19h. How big was your framework / how many test cases / what was your role? Have real numbers ready: "~X automated test cases, suite runs in ~Y minutes in Jenkins nightly, I owned the API layer + reviewed the team's PRs." Interviewers check if your experience is genuine β€” concrete numbers sell it.


Q20. Overloading vs Overriding. - Overloading = same method name, different parameters, same class, decided at compile time. - Overriding = child class redefines parent method, same signature, decided at runtime.

πŸ“ In my project: overloading β†’ BasePage.java:37 & 41 (click(By) vs click(WebElement)); overriding β†’ ScreenshotListener.java:24 overrides onTestFailure() from ITestListener.

Q21. throw vs throws (Infosys asked). - throw = actually throw an exception (throw new RuntimeException()). - throws = declares in the method signature that it may throw an exception.

πŸ“ In my project: ConfigReader.java uses throw new RuntimeException(...) when a config key is missing; ActionsAndTablesTest.java:81 declares throws IOException on the file-upload test.

Q22. Checked vs Unchecked exceptions. - Checked = caught at compile time, must handle (IOException, SQLException). - Unchecked = at runtime (NullPointerException, ArrayIndexOutOfBounds).

Q23. final vs finally vs finalize (classic). - final = keyword to make variable/method/class unchangeable. - finally = block that always runs (used to close resources). - finalize = old method called by garbage collector before object is destroyed (deprecated now).

Q24. When do you use a finally block? To run cleanup code no matter what β€” closing files, DB connections, quitting the driver. It runs whether or not an exception happened.

πŸ“ In my project: I do the same cleanup with TestNG's @AfterMethod in BaseTest.java:30-36 β€” driver.quit() always runs after each test, the same guarantee a finally gives.

Q25. Collections β€” key differences (memorize the table): | | ArrayList | LinkedList | |---|---|---| | Storage | Dynamic array | Doubly linked nodes | | Access (get) | Fast (index) | Slow | | Insert/delete middle | Slow | Fast |

HashMap HashSet
Stores Key-Value pairs Only values
Duplicates Keys unique, values can repeat No duplicates
List Set
Duplicates Allowed Not allowed
Order Maintains insertion order May not

πŸ“ In my project: List<String> of product names in ProductsPage.java:43-46; List<WebElement> of checkboxes in ActionsAndTablesTest.java:31; Set<String> of window handles in AlertsFramesWindowsTest.java:77 (handles are unique β†’ Set fits).

Q26. Comparable vs Comparator. - Comparable β€” natural single sort order, compareTo(), implemented in the class itself. - Comparator β€” multiple/custom sort orders, compare(), written outside the class.

πŸ“ In my project: DropdownTest.java uses Comparator.reverseOrder() to verify the SauceDemo "Name (Z to A)" sort produced a correctly descending list.

Q27. Can we override static methods? No β€” static belongs to the class, not the object. (Re-declaring it is method hiding, not overriding.)

Q28. Can a constructor be private? Yes β€” used in Singleton pattern to stop outside object creation.

Q29. Common coding asks (practice these): - Reverse a string / check palindrome. - Count character occurrences using a HashMap. - Find duplicates in an array / find second highest number. - Swap two numbers without a third variable.

Example β€” character count:

String s = "infosys";
Map<Character, Integer> map = new HashMap<>();
for (char c : s.toCharArray()) {
    map.put(c, map.getOrDefault(c, 0) + 1);
}
System.out.println(map);


3) Selenium + Java (JD: 5–10 yrs Selenium)

Q30. Explain your framework / architecture. "Hybrid framework β€” Page Object Model + data-driven, on Java + Selenium 4 + TestNG + Maven." - POM: each page = one class with locators + methods. - TestNG for execution, grouping, parallel, retry. - Maven + Surefire to run from CLI/CI. - ExtentReports for reporting, screenshots on failure. - Config in properties files, test data in Excel/JSON. - REST Assured for API layer, Cucumber for BDD. - Jenkins for CI.

πŸ“ In my project: this exact architecture is real β€” POM in pages/, driver setup in DriverFactory.java, parallel suite in testng.xml, deps in pom.xml, config in config.properties. (Note: my project uses fail-only screenshots via a listener; Cucumber/Jenkins are in my work framework, not this practice repo.)

Q31. StaleElementReferenceException β€” what & fix? (Infosys asked) It happens when an element was found, but then the DOM changed/refreshed, so the old reference is no longer valid. Fix: re-find the element (re-locate), use explicit waits, or wrap in a retry/try-catch and find again.

πŸ“ In my project: I avoid it by re-finding through wait helpers each time β€” BasePage.java's click()/type() call waitClickable()/waitVisible() (a fresh findElement) instead of caching a WebElement.

Q32. Types of waits β€” write the syntax:

// Implicit wait (global)
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));

// Explicit wait (specific condition)
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("login")));

// Fluent wait (polling + ignore exceptions)
Wait<WebDriver> fluent = new FluentWait<>(driver)
    .withTimeout(Duration.ofSeconds(30))
    .pollingEvery(Duration.ofSeconds(5))
    .ignoring(NoSuchElementException.class);
- Implicit = waits for all elements globally. - Explicit = waits for one specific condition. - Fluent = explicit + custom polling + ignore exceptions.

πŸ“ In my project: implicit set globally in DriverFactory.java:45-46; explicit in WaitsTest.java:30-31; fluent in WaitsTest.java:43-49. Reusable wait helpers live in BasePage.java.

Q33. Window/tab handling β€” snippet:

String parent = driver.getWindowHandle();
for (String handle : driver.getWindowHandles()) {
    if (!handle.equals(parent)) {
        driver.switchTo().window(handle);
    }
}
driver.switchTo().window(parent); // back to parent

πŸ“ In my project: working version in AlertsFramesWindowsTest.java:69-82 β€” opens a new window, switches by handle, closes the child, returns to parent.

Q34. Frame handling β€” switch to parent frame?

driver.switchTo().frame("frameName");      // enter
driver.switchTo().parentFrame();           // go to immediate parent
driver.switchTo().defaultContent();        // go to main page

πŸ“ In my project: AlertsFramesWindowsTest.java:48-67 switches into the TinyMCE iframe, interacts, then defaultContent() back. Real lesson learned: clear() throws on a contenteditable body β€” I cleared it via JavascriptExecutor instead.

Q35. Absolute vs Relative XPath. - Absolute = full path from root /html/body/... (fragile, breaks easily). - Relative = starts anywhere //tag[@attr='value'] (preferred). - XPath with contains: //button[contains(text(),'Submit')]

πŸ“ In my project: LoginPage.java:14-17 deliberately uses one of each β€” By.id (relative), By.cssSelector, and By.xpath("//h3[@data-test='error']") (relative xpath with attribute).

Q36. XPath vs CSS β€” which is faster? CSS is generally faster and supported better by browsers; XPath is more powerful (can go to parent, traverse both directions, match text).

Q37. driver.get() vs driver.navigate().to()? - get() β€” opens URL, waits for full page load, no history. - navigate().to() β€” opens URL but keeps browser history, so you can use back()/forward().

Q38. New features in Selenium 4. - W3C protocol (no JSON wire protocol). - Relative locators (above/below/near). - Native Chrome DevTools access. - New window/tab API (newWindow). - Better Selenium Grid (Docker, observability).

Q39. Page Factory β€” what & why? A way to initialize page objects with @FindBy and PageFactory.initElements(driver, this). It makes element declaration cleaner and supports lazy initialization.

πŸ“ Honest note: my practice project uses plain By locators in the page classes (LoginPage.java), not PageFactory β€” many teams now prefer By because PageFactory's @FindBy is effectively deprecated/less flexible. So I'd say: "I use the By-locator style of POM; PageFactory with @FindBy is the older alternative."

Q40. Broken links β€” how to find? Collect all <a> tags β†’ get href β†’ send an HTTP HEAD/GET request to each β†’ if response code β‰₯ 400, it's broken.

πŸ“ In my project: full working version in BrokenLinksTest.java β€” streams the <a> hrefs (L27), then HttpURLConnection with HEAD and getResponseCode() (L47-53).

Q41. How do you take screenshots only for failed tests in TestNG? Use ITestListener.onTestFailure() (or @AfterMethod checking ITestResult.FAILURE) and call TakesScreenshot. This way screenshots are captured only when a test fails.

πŸ“ In my project: ScreenshotListener.java:24-31 implements onTestFailure() and saves a PNG via TakesScreenshot; registered in testng.xml.

Q42. 200 test cases, 49 failed β€” how to get only failed ones / rerun? - TestNG auto-creates testng-failed.xml β€” run that to re-execute only failed tests. - Or use IRetryAnalyzer to auto-retry failed tests. - Use ITestListener to collect failed results into a report.

πŸ“ In my project: RetryAnalyzer.java implements IRetryAnalyzer, and RetryListener.java (IAnnotationTransformer) applies it to every @Test automatically β€” so flaky tests (like HTML5 drag-and-drop) auto-rerun.


4) BDD / Cucumber (JD: hands-on BDD)

πŸ“ Honest note for this section: my selenium-restassured-practice repo does not include Cucumber yet (I can add a feature + step-defs layer over the SauceDemo login). Talk about BDD from my work framework. The closest thing in the practice repo is the data-driven @DataProvider in LoginTest.java:30-46, which is the same idea as a Scenario Outline's Examples table (Q45).

Q43. What is BDD? Behavior Driven Development β€” write tests in plain English (Gherkin) so business, devs and QA all understand. Format: Given–When–Then.

Q44. Gherkin keywords. Feature, Scenario, Given, When, Then, And, But, Background, Scenario Outline, Examples.

Q45. What is a Scenario Outline? (Infosys asked) It runs the same scenario multiple times with different data using an Examples table β€” Cucumber's way of data-driven testing.

Scenario Outline: Login with multiple users
  Given user enters "<username>" and "<password>"
  Then login should be "<result>"
  Examples:
    | username | password | result  |
    | valid    | valid    | success |
    | wrong    | valid    | failure |

Q46. Cucumber framework parts. - Feature file (.feature, Gherkin) - Step definitions (Java glue code) - Runner class (TestNG/JUnit + @CucumberOptions) - Hooks (@Before, @After) - Tags (@smoke, @regression) to run subsets

Q47. Background vs Hooks. - Background = steps repeated before every scenario, written in Gherkin (visible to business). - Hooks = @Before/@After setup/teardown in code (not in feature file).


5) SQL (JD: good experience in SQL)

Q48. Joins β€” explain simply. - INNER JOIN β€” only matching rows in both tables. - LEFT JOIN β€” all rows from left + matching from right (nulls if none). - RIGHT JOIN β€” all from right + matching from left. - FULL JOIN β€” all rows from both.

Q49. WHERE vs HAVING. - WHERE filters rows before grouping. - HAVING filters after GROUP BY (used with aggregates).

Q50. Find 2nd highest salary (very common):

SELECT MAX(salary) FROM employees
WHERE salary < (SELECT MAX(salary) FROM employees);
Or:
SELECT salary FROM employees ORDER BY salary DESC LIMIT 1 OFFSET 1;

Q51. Find duplicate records:

SELECT name, COUNT(*) 
FROM employees 
GROUP BY name 
HAVING COUNT(*) > 1;

Q52. DELETE vs TRUNCATE vs DROP. - DELETE β€” removes rows (can use WHERE, can rollback). - TRUNCATE β€” removes all rows fast (no WHERE, can't easily rollback). - DROP β€” removes the whole table/structure.

Q53. Primary key vs Unique key vs Foreign key. - Primary β€” unique + not null, one per table. - Unique β€” unique values, allows one null. - Foreign β€” links to primary key of another table (relationship).

Q54. GROUP BY example β€” count orders per customer:

SELECT customer_id, COUNT(*) AS total_orders
FROM orders
GROUP BY customer_id;


6) CI/CD, Git, Jenkins (JD: integrate scripts with CI/CD)

Q55. How do automation scripts fit in CI/CD? On every code push, Jenkins (or GitHub Actions) pulls code β†’ builds with Maven β†’ runs the automated tests β†’ publishes the report. Failures block the pipeline / notify the team. Tests give fast feedback on each build.

πŸ“ In my project: mvn test is the CI entry point β€” pom.xml wires the Surefire plugin to run testng.xml, and -DsuiteXmlFile=testng-api.xml / -Dheadless=true let CI pick suite + headless mode. A Jenkins job would just call mvn test. (Jenkinsfile itself is in my work framework, not this repo.)

Q56. How to schedule a Jenkins pipeline? (Infosys asked) - Build Triggers β†’ "Build periodically" using cron syntax (e.g. H 2 * * * = ~2 AM daily). - Or "Poll SCM" to run on code change, or webhook trigger from Git.

Q57. Basic Git commands & merge conflict (Infosys asked). git clone, pull, add, commit, push, branch, checkout, merge, stash, log. Merge conflict = same lines changed in two branches. Fix: open the file, choose/combine the correct code between the <<<</====/>>>> markers, then git add + git commit.

Q58. What is a Jenkinsfile? A text file (pipeline-as-code) that defines pipeline stages (build, test, deploy) using Groovy, stored in the repo.

πŸ“ Honest note: no Jenkinsfile in my practice repo, but a minimal one would be: stage('Test'){ sh 'mvn test -Dheadless=true' } then post { always { publishHTML / junit '**/surefire-reports/*.xml' } }. The repo is already CI-ready because everything runs from mvn test.


7) Agile, Test Design & QA Process

Q59. Scrum vs Kanban. - Scrum β€” fixed sprints (e.g. 2 weeks), roles, ceremonies. - Kanban β€” continuous flow, no sprints, limit work-in-progress on a board.

Q60. Agile ceremonies. Sprint Planning, Daily Stand-up, Sprint Review, Sprint Retrospective, Backlog Grooming.

Q61. Test design techniques (JD asks this). - Equivalence Partitioning β€” group inputs that behave the same, test one per group. - Boundary Value Analysis β€” test edges (min, max, just inside/outside). - Decision Table β€” combinations of conditions. - State Transition β€” test states and transitions. - Error Guessing β€” based on experience.

Q62. Smoke vs Sanity. - Smoke β€” quick check that the build is stable enough to test (build verification). - Sanity β€” narrow, deep check of a specific fixed area/feature.

Q63. Regression vs Retesting. - Retesting β€” test the same bug again to confirm it's fixed. - Regression β€” test other areas to confirm the fix didn't break anything.

Q64. Severity vs Priority. - Severity β€” how badly it affects the system (technical impact). - Priority β€” how soon it must be fixed (business urgency). - Example: company logo wrong = high priority, low severity. Rare crash = high severity, low priority.

Q65. Defect life cycle. New β†’ Assigned β†’ Open β†’ Fixed β†’ Retest β†’ Closed (or Reopen / Rejected / Deferred / Duplicate).

Q66. How do you raise a defect in JIRA? Create issue type Bug β†’ add summary, steps to reproduce, expected vs actual, severity/priority, environment, screenshots/logs, attach to the user story/sprint, assign to dev. Track it through the lifecycle.

Q67. What is RTM (Requirement Traceability Matrix)? (JD asks) A document/sheet mapping each requirement to its test cases (and defects). It proves every requirement is tested — ensures full coverage, both forward (req→test) and backward (test→req).

Q68. Test Plan vs Test Strategy. - Test Plan β€” project-specific doc: scope, schedule, resources, what/how to test (changes per project). - Test Strategy β€” high-level org-wide approach (more static).

Q69. How do you decide what to automate? Automate: repetitive, stable, high-risk, regression, data-driven tests. Don't automate: one-time tests, frequently changing UI, exploratory, captcha. (Use ROI as the deciding factor.)

Q70. Lots of bugs during deployment β€” how do you handle it? (Infosys asked) Prioritize by severity/priority, do a smoke test first, log all defects clearly in JIRA, raise to the team in stand-up, do root-cause analysis, consider rollback if release-blocking, and add regression/automated tests to prevent recurrence.


8) Leadership / Onsite-Offshore (JL5 = lead role, expect these)

Q71. How do you lead/mentor a team? Distribute work by skill, review code/test cases, run daily syncs, unblock the team, define automation standards, track coverage and quality metrics, and coordinate between onsite and offshore.

Q72. How does the onsite-offshore model work? Onsite team interacts with the client/business and gathers requirements; offshore does the bulk execution. Success needs clear handoffs, overlapping hours for sync, good documentation, and status reporting.

Q73. How do you define an automation strategy? (JD asks) Pick the right tools/framework, decide scope (what to automate by ROI), set coding standards, integrate with CI/CD, plan test data/environments, define reporting, and set maintenance/review practices.


8b) Extra questions reported in recent (late-2025 / 2026) Infosys interviews

These came from 2026 interview-experience pages. They overlap a lot with above; new/different ones are answered here.

Q73a. Coding: write automation for the Facebook (or any) login screen. Show POM thinking: locate username/password/login button, enter data, click, assert landing/dashboard or error message. Mention waits + assertions.

πŸ“ In my project: exactly this β€” LoginPage.java (private locators + loginAs()/attemptLogin()) driven by LoginTest.java (valid login asserts the Products page; invalid asserts the error text). If asked to write it live, reproduce this POM shape.

Q73b. Java "diamond problem" β€” what is it? When a class could inherit the same method from two parents, it's ambiguous which to use. Java avoids it for classes (no multiple class inheritance). With interfaces having default methods, you must override and pick using InterfaceName.super.method().

Q73c. Find the second largest number in an array.

int largest = Integer.MIN_VALUE, second = Integer.MIN_VALUE;
for (int n : arr) {
    if (n > largest) { second = largest; largest = n; }
    else if (n > second && n != largest) { second = n; }
}

Q73d. What is the JVM? Why is Java platform-independent? Java code compiles to bytecode; the JVM (different for each OS) runs that same bytecode. "Write once, run anywhere." The JVM is the layer that makes Java platform-independent.

Q73e. What is a ClassLoader? The part of the JVM that loads .class files into memory at runtime. Three types: Bootstrap β†’ Extension β†’ Application loader.

Q73f. How are regression reports generated? Run the regression suite via TestNG/Maven in Jenkins β†’ results captured by ExtentReports / Allure / TestNG default report β†’ published in the pipeline and shared with the team. Failed cases highlighted with screenshots/logs.

Q73g. Explain web services architecture. A web service lets two applications talk over a network using standard protocols (HTTP). Client sends a request to an endpoint β†’ server processes β†’ returns a response (JSON/XML). Two styles: REST (HTTP + JSON) and SOAP (XML + WSDL).


8c) Test artifacts, ALM/JIRA, TestNG & Maven (JD gap-fillers)

Q73h. What is a good test case? What does it contain? A test case is a set of steps to verify one requirement. Fields: Test Case ID, Title, Pre-conditions, Test Data, Steps, Expected Result, Actual Result, Status (Pass/Fail), Priority. A good test case is clear, independent, traceable to a requirement, and reusable.

Q73i. How do you write a test script vs a test case? - Test case = manual, plain-English steps + expected result. - Test script = the automation code that performs those steps and asserts the result (e.g. a Selenium/REST Assured method).

Q73j. What is ALM? (JD says "ALM/JIRA") ALM = Application Lifecycle Management β€” HP/Micro Focus ALM (formerly Quality Center). It's a tool to manage the whole testing lifecycle: store requirements, write/organize test cases, plan test runs/execution, log defects, and link them all for traceability and reporting. Compared to JIRA: JIRA is agile/issue-tracking-first; ALM is a dedicated end-to-end test-management tool with strong requirement-to-defect traceability. (If you've only used JIRA, say so honestly and explain how you'd manage the same artifacts in JIRA + Zephyr/Xray.)

Q73k. JIRA + test management β€” how do you manage test cases in JIRA? JIRA itself tracks stories/bugs; for test cases teams add plugins like Zephyr or Xray to write test cases, build cycles, and link tests to requirements and defects (RTM-style).

Q73l. Common TestNG annotations (know the order). @BeforeSuite β†’ @BeforeTest β†’ @BeforeClass β†’ @BeforeMethod β†’ @Test β†’ @AfterMethod β†’ @AfterClass β†’ @AfterTest β†’ @AfterSuite. Other useful: @DataProvider (data-driven), @Parameters (from XML), priority, groups, dependsOnMethods, enabled=false, @Listeners.

πŸ“ In my project: @BeforeMethod/@AfterMethod in BaseTest.java; priority + dependsOnMethods to order the CRUD chain in RestfulBookerCrudTest.java:81; groups = {"smoke"/"regression"} across tests; @DataProvider in LoginTest.java:30.

Q73m. Why TestNG over JUnit (for your framework)? Built-in parallel execution, grouping, dependencies, data providers, flexible XML suite control, better reporting, and retry/listeners.

πŸ“ In my project: testng.xml runs parallel="classes" thread-count="3" and registers listeners β€” exactly the TestNG-only features I'd lose with plain JUnit.

Q73n. What is Maven and why use it? A build + dependency management tool. pom.xml declares dependencies (Selenium, REST Assured, TestNG) and Maven downloads them; lifecycle phases compile β†’ test β†’ package. Surefire plugin runs tests (e.g. mvn test), which is how Jenkins triggers the suite.

πŸ“ In my project: pom.xml declares Selenium 4, REST Assured, TestNG, json-schema-validator; sets maven.compiler.release=25; and configures Surefire with a ${suiteXmlFile} property so I can run the full or API-only suite.

Q73o. How do you keep tests independent / handle test data? Each test sets up its own data and cleans up (no test depends on another's state). Test data from external files (Excel/CSV/JSON) or a data layer/API; use @BeforeMethod for fresh setup. This makes parallel runs and reruns reliable.

πŸ“ In my project: BaseTest.java gives each test a fresh driver via @BeforeMethod and a ThreadLocal<WebDriver> (so parallel threads don't clash), then @AfterMethod quits it. Config/data is externalised in config.properties.


9) Last-night checklist βœ…

  • [ ] Can I write given().when().then() REST Assured code from memory?
  • [ ] Status codes: 200, 201, 204, 400, 401, 403, 404, 429, 500.
  • [ ] JWT, OAuth 2.0, Bearer token β€” one clear line each.
  • [ ] OOPs mapped to MY framework (give a real example).
  • [ ] final/finally/finalize, throw/throws, overloading/overriding.
  • [ ] Collections table (ArrayList/LinkedList, HashMap/HashSet, List/Set).
  • [ ] 3 waits with syntax; StaleElement fix; window & frame handling.
  • [ ] SQL: joins, 2nd highest salary, find duplicates, WHERE vs HAVING.
  • [ ] Cucumber: Given-When-Then, Scenario Outline, framework parts.
  • [ ] Jenkins scheduling, Git merge conflict, CI/CD flow.
  • [ ] Severity vs Priority, Smoke vs Sanity, RTM, defect lifecycle.
  • [ ] My "Tell me about yourself" in 60 seconds.
  • [ ] 2–3 STAR stories: a hard bug, a framework I built, leading a team.
  • [ ] Re-run my project once: mvn test -DsuiteXmlFile=testng-api.xml (API) and skim RestfulBookerCrudTest + LoginTest β€” so I can quote real file names confidently.
  • [ ] My 2 real bug stories: REST Assured 418 (Accept-header) fix, and iframe contenteditable clear() fix.

Golden rules in the room: Answer the one-line first β†’ give a real example from your project β†’ stop. If you don't know, say "I haven't used that directly, but my understanding is…". Stay calm, speak slowly.


Sources (recent Infosys interview experiences)