Created
October 13, 2017 19:37
-
-
Save eliasnogueira/784798028a50a3e8226210cf1a6c00b0 to your computer and use it in GitHub Desktop.
RestAssured example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void getPersonById() { | |
int personID = | |
given() | |
.contentType(ContentType.JSON) | |
.body(new Person("Elias Nogueira", "RS", "Automate tests")). | |
when(). | |
post("person"). | |
then(). | |
extract(). | |
path("id"); | |
when(). | |
get("person/{id}", personID). | |
then(). | |
contentType("application/json").and(). | |
body("name", equalTo("Elias Nogueira")).and(). | |
body("address", equalTo("RS")).and(). | |
body("hobbies", equalTo("Automate tests")).and(). | |
statusCode(200); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment