- Testing and validating REST services | Java -- is harder than -- | dynamic languages (Example: Ruby and Groovy)
- REST Assured
- allows
- bringing the simplicity of dynamic languages -- into the -- Java
- specifying and validating
- parameters
- headers
- cookies
- body
- supports ANY HTTP method /
- explicit support for POST, GET, PUT, DELETE, OPTIONS, PATCH and HEAD
- allows
- 2024-07-05: REST Assured 5.5.0 is released with several bug fixes and a new Scala 3 Extension Module. See change log for more details.
- 2023-12-08: REST Assured 5.4.0 is released with several bug fixes and a Kotlin Extension Module for Spring WebTest. See change log for more details.
- 2023-09-08: REST Assured 5.3.2 is released with several bug fixes, better Spring MockMvc Support, better support for newer versions of Spring Security etc. See change log for more details.
-
make a GET request & validate the JSON or XML response
get("/lotto").then().assertThat().body("lotto.lottoId", equalTo(5)); get("/lotto").then().assertThat().body("lotto.winners.winnerId", hasItems(23, 54));
-
-- via -- parameters
given(). param("key1", "value1"). param("key2", "value2"). when(). post("/somewhere"). then(). body(containsString("OK"));
-
-- via -- X-Path (XML only)
given(). params("firstName", "John", "lastName", "Doe"). when(). post("/greetMe"). then(). body(hasXPath("/greeting/firstName[text()='John']")).
-
authentication mechanisms provided
given().auth().basic(username, password).when().get("/secured").then().statusCode(200);
-
Getting and parsing a response body
// Example with JsonPath String json = get("/lotto").asString(); List<String> winnerIds = from(json).get("lotto.winners.winnerId"); // Example with XmlPath String xml = post("/shopping").andReturn().body().asString(); Node category = from(xml).get("shopping.category[0]");
- Getting started
- Usage Guide (click here for legacy documentation)
- Javadoc
- Rest Assured Javadoc
- Rest AssuredMockMvc Javadoc
- XmlPath Javadoc
- JsonPath Javadoc
- Release Notes
- FAQ
Join the mailing list at our Google group.
- Change log
- REST Assured on openhub
- Mailing list for questions and support