Skip to content

REST Assured interview questions — Medium

310 medium-level REST Assured questions from our API Testing bank, each with the correct answer and an explanation of why it is correct.

What this covers

REST Assured appears throughout API Testing interviews. At medium level, interviewers are typically checking that you have used it in practice: what you configured, what broke, and how you knew it worked. Work through these, then explain your answer out loud; the second part is what interviews actually test.

20 example questions

  1. 1. In a test-strategy meeting, the question comes up: How do you assert data.id == 5 in a REST Assured body?

    • A. Body("data.id", equalTo(5)).correct
    • B. AssertEquals(5).
    • C. Then().json(5).
    • D. Expect(5).

    Why: REST Assured uses JsonPath with Hamcrest matchers.

  2. 2. Which of the following statements about REST Assured is TRUE?

    • A. REST Assured supports logging of requests and responses for debugging with log().all().correct
    • B. REST Assured is a JavaScript library for browser testing.
    • C. REST Assured has no support for OAuth2 authentication.
    • D. REST Assured cannot validate nested JSON fields.

    Why: Conditional logging like log().ifValidationFails() keeps output clean.

  3. 3. "Sends the HTTP request to the endpoint" — in REST Assured, this describes which of the following?

    • A. ContentType(ContentType.JSON).
    • B. QueryParam.
    • C. When().get("/users").correct
    • D. PathParam.

    Why: when().get("/users"): Sends the HTTP request to the endpoint.

  4. 4. "Sets or asserts the JSON content type" — in REST Assured, this describes which of the following?

    • A. ResponseSpecification.
    • B. RelaxedHTTPSValidation().
    • C. Given().
    • D. ContentType(ContentType.JSON).correct

    Why: contentType(ContentType.JSON): Sets or asserts the JSON content type.

  5. 5. "Starts request specification: params, headers, body, auth" — in REST Assured, this describes which of the following?

    • A. RelaxedHTTPSValidation().
    • B. Then().statusCode(200).
    • C. Given().correct
    • D. PathParam.

    Why: given(): Starts request specification: params, headers, body, auth.

  6. 6. "Begins validation of the received response" — in REST Assured, this describes which of the following?

    • A. ContentType(ContentType.JSON).
    • B. QueryParam.
    • C. Then().statusCode(200).correct
    • D. RelaxedHTTPSValidation().

    Why: then().statusCode(200): Begins validation of the received response.

  7. 7. "Disables SSL certificate validation for test environments" — in REST Assured, this describes which of the following?

    • A. Given().
    • B. PathParam.
    • C. Then().statusCode(200).
    • D. RelaxedHTTPSValidation().correct

    Why: relaxedHTTPSValidation(): Disables SSL certificate validation for test environments.

  8. 8. REST Assured tests are typically structured with which readable BDD-style syntax?

    • A. Arrange/act/assert keywords only.
    • B. Given() / when() / then().correct
    • C. Setup() / run() / verify().
    • D. Open() / send() / close().

    Why: REST Assured uses a BDD-style given() (setup: headers, params, body), when() (the request), then() (assertions).

  9. 9. "Sets a named path parameter in the URL template" — in REST Assured, this describes which of the following?

    • A. QueryParam.
    • B. ResponseSpecification.
    • C. When().get("/users").
    • D. PathParam.correct

    Why: pathParam: Sets a named path parameter in the URL template.

  10. 10. During a code review, a reviewer asks: REST Assured tests use which readable style?

    • A. Arrange/act/assert.
    • B. Given()/when()/then().correct
    • C. Open/send/close.
    • D. Setup/run/verify.

    Why: REST Assured uses BDD-style given/when/then.

  11. 11. "Adds a query string parameter to the request" — in REST Assured, this describes which of the following?

    • A. Given().
    • B. PathParam.
    • C. Then().statusCode(200).
    • D. QueryParam.correct

    Why: queryParam: Adds a query string parameter to the request.

  12. 12. Identify the accurate statement about REST Assured:

    • A. REST Assured has no support for OAuth2 authentication.
    • B. REST Assured cannot validate nested JSON fields.
    • C. REST Assured is a JavaScript library for browser testing.
    • D. JSON Schema validation is supported via the json-schema-validator module.correct

    Why: matchesJsonSchemaInClasspath validates structure, not just values.

  13. 13. Which statement correctly describes REST Assured?

    • A. REST Assured is a JavaScript library for browser testing.
    • B. Response values cannot be extracted for use in later requests.
    • C. JSON Schema validation is supported via the json-schema-validator module.correct
    • D. REST Assured cannot validate nested JSON fields.

    Why: matchesJsonSchemaInClasspath validates structure, not just values.

  14. 14. extract().path("token") is used to:

    • A. Send a request.
    • B. Pull a value from the response for reuse.correct
    • C. Assert time.
    • D. Log headers.

    Why: extract() pulls values (JsonPath) to reuse, e.g. an auth token.

  15. 15. In REST Assured, which of the following is described as: "Begins validation of the received response"?

    • A. ContentType(ContentType.JSON).
    • B. Then().statusCode(200).correct
    • C. QueryParam.
    • D. ResponseSpecification.

    Why: then().statusCode(200): Begins validation of the received response.

  16. 16. In the context of REST Assured, which of the following is a correct statement?

    • A. REST Assured is a JavaScript library for browser testing.
    • B. REST Assured supports logging of requests and responses for debugging with log().all().correct
    • C. RequestSpecification must be redefined inside every single test.
    • D. REST Assured has no support for OAuth2 authentication.

    Why: Conditional logging like log().ifValidationFails() keeps output clean.

  17. 17. In REST Assured, which of the following is described as: "Sends the HTTP request to the endpoint"?

    • A. ResponseSpecification.
    • B. Given().
    • C. RelaxedHTTPSValidation().
    • D. When().get("/users").correct

    Why: when().get("/users"): Sends the HTTP request to the endpoint.

  18. 18. Which REST Assured concept matches this description: "Starts request specification: params, headers, body, auth"?

    • A. Then().statusCode(200).
    • B. ResponseSpecification.
    • C. RelaxedHTTPSValidation().
    • D. Given().correct

    Why: given(): Starts request specification: params, headers, body, auth.

  19. 19. In REST Assured, which of the following is described as: "Reusable set of response expectations"?

    • A. ResponseSpecification.correct
    • B. Given().
    • C. QueryParam.
    • D. PathParam.

    Why: ResponseSpecification: Reusable set of response expectations.

  20. 20. Which REST Assured concept matches this description: "Reusable set of response expectations"?

    • A. When().get("/users").
    • B. RelaxedHTTPSValidation().
    • C. QueryParam.
    • D. ResponseSpecification.correct

    Why: ResponseSpecification: Reusable set of response expectations.

Related API Testing topics