Java REST Assured Interview Study
Guide (6+ Years Experience)
This guide is designed for experienced API Automation Engineers preparing for senior-level
interviews.
1. What is REST Assured?
REST Assured is a Java library for testing REST APIs. It provides a fluent DSL for sending
HTTP requests and validating responses.
import static [Link].*;
given()
.baseUri("[Link]
.when()
.get("/api/users/2")
.then()
.statusCode(200);
2. HTTP Methods
GET retrieves data, POST creates, PUT replaces, PATCH partially updates, DELETE removes
resources.
3. Request Specification
Reusable request configuration avoids duplication.
RequestSpecification req = given()
.baseUri(BASE_URL)
.header("Authorization","Bearer <token>")
.contentType([Link]);
4. Response Validation
Validate status, headers and body using Hamcrest matchers.
given()
.when().get("/api/users/2")
.then()
.statusCode(200)
.body("[Link]", equalTo(2))
.header("Content-Type", containsString("application/json"));
5. Serialization & Deserialization
Convert Java objects to JSON and JSON back into POJOs.
User user = new User();
[Link]("John");
given().body(user).post("/users");
// Deserialize
UserResponse response = given().get("/users/2").as([Link]);
Sample Interview Questions
No. Question Answer
1 1. What is REST Assured? REST Assured is a Java DSL
for automating REST API
testing with built-in request
building and response
validation.
2 2. Difference between PUT PUT replaces the entire
and PATCH? resource whereas PATCH
updates only specified
fields.
3 3. What is It stores reusable request
RequestSpecification? configuration such as base
URI, headers and
authentication.
4 4. How do you perform Use .header("Authorization"
Bearer Token ,"Bearer <token>") or
authentication? OAuth2 support.
5 5. Explain API Chaining. Extract values like token or
ID from one API response
and reuse them in later
requests.
Topics to Master
REST Fundamentals
HTTP Status Codes
JSONPath
Authentication (Basic, OAuth2, JWT)
Schema Validation
File Upload/Download
Framework Design
TestNG Integration
Jenkins CI/CD
Database Validation
Logging
Environment Management