Java + API Automation Testing Interview
Guide
Core Java Questions
What are OOP principles and how do they help in test automation?
Explain the difference between List, Set, and Map.
How does HashMap work internally?
What is the difference between final, finally, and finalize()?
What are checked and unchecked exceptions?
What is a Singleton class and where is it used?
Explain static vs non-static methods in utility classes.
What are lambda expressions and how are they used in automation?
Java for API Automation
Why use Rest Assured for API automation testing?
How do you handle dynamic JSON fields in response validation?
What is a POJO and how is it used in Rest Assured?
How do you structure a framework using TestNG and Maven?
How to implement retry logic in TestNG?
How do you validate nested JSON responses?
How do you send headers and query parameters in a request?
How do you integrate your automation suite with Jenkins?
API Concepts
Explain various HTTP methods used in REST APIs.
What status codes do you commonly validate in automation?
Difference between PUT and PATCH.
What is idempotency in REST APIs?
How do you handle token-based authentication in automation?
How do you test pagination in REST APIs?
What is throttling/rate-limiting and how do you test it?
Practical Java Programs
1. GET request and validate status code and response field.
2. POST request with JSON payload using JSONObject.
3. Deserialize JSON response using POJOs.
4. Data-driven testing with TestNG @DataProvider.
5. Retry mechanism in TestNG using IRetryAnalyzer.
6. Read values from a [Link] file.
7. BaseTest class to setup baseURI and configuration.
8. Logging API responses using Log4j or SLF4J.