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.

2 example questions

  1. 1. In REST Assured, how do you assert a JSON field like data.id equals 5 in the body?

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

    Why: REST Assured uses JsonPath expressions with Hamcrest matchers, e.g. .body("data.id", equalTo(5)).

  2. 2. 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).

Related API Testing topics