Last active
July 29, 2018 02:15
-
-
Save amaralrfl/37c1837dd997df9ab355eb9ab99b37c5 to your computer and use it in GitHub Desktop.
Class to configure and try run Rest Assured
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
import org.testng.annotations.Test; | |
import static io.restassured.RestAssured.get; | |
import static io.restassured.RestAssured.given; | |
import static org.hamcrest.core.IsEqual.equalTo; | |
public class RestAssuredTest { | |
String url = "https://reqres.in/api/users"; | |
@Test | |
public void getPageOne(){ | |
given(). | |
param("page", "1"). | |
when(). | |
get(url). | |
then(). | |
statusCode(200). | |
body("page", equalTo(1)); | |
} | |
@Test | |
public void getUser() { | |
get(url + "/2").then().body("data.id", equalTo(2)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment