1、创建Java class
2、倒入RestAssured包
import static io.restassured.RestAssured.*;
3、语法使用
public static void main(String[] args){
given().
//此处可添加请求头、请求参数、请求体等
when().
//此处添加请求方式(例如:get/post请求)
then().//此处为断言,结果
log().all();
}
TestNG基本配置
1、maven中搜索testng,点击search,
2、选择以下任意版本--推荐使用人数较多版本
<dependencies>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
3、复制以上配置文件到pom.xml中