<dependency> <groupId>io.rest-assured</groupId> <artifactId>rest-assured</artifactId> <version>4.3.3</version> <scope>test</scope> </dependency> import org.junit.Test; import static io.restassured.RestAssured.*; import static org.hamcrest.Matchers.*; public class RestAssuredExampleTest { @Test public void testGetRequest() { given() .when() .get("https://api.example.com/users/1") .then() .statusCode(200) .body("name", equalTo("John Doe")) .body("age", greaterThan(18)); } }


上一篇:
下一篇:
切换中文