其他分享
首页 > 其他分享> > RestAssured测试接口(1)- 总论

RestAssured测试接口(1)- 总论

作者:互联网

目录

概述

REST Assured支持发起POST,GET,PUT,DELETE,OPTIONS,PATCH和HEAD请求,并且可以获取和验证请求的响应信息
本系列文章主要是要构建一个 基于 Rest Assured + TestNG 的自动化测试框架

功能

官网

https://rest-assured.io/

Maven依赖

//Rest-assured
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>4.2.0</version>
        </dependency>
//Stand-alone XmlPath (included if you depend on the rest-assured artifact). Makes it easy to parse XML documents.
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>xml-path</artifactId>
            <version>4.2.0</version>
        </dependency>

//Standalone JsonPath (included if you depend on the rest-assured artifact). Makes it easy to parse JSON documents.
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-path</artifactId>
            <version>4.2.0</version>
        </dependency>

//If you're using Spring Mvc you can now unit test your controllers using the RestAssuredMockMvc API in the spring-mock-mvc module. For this to work you need to depend on the spring-mock-mvc module:
        <dependency>
              <groupId>io.rest-assured</groupId>
              <artifactId>spring-mock-mvc</artifactId>
              <version>4.2.0</version>
        </dependency>

//If you're using Spring Webflux you can now unit test your reactive controllers using the RestAssuredWebTestClient API in the spring-mock-mvc module. For this to work you need to depend on the spring-web-test-client module:

        <dependency>
              <groupId>io.rest-assured</groupId>
              <artifactId>spring-web-test-client</artifactId>
              <version>4.3.3</version>
              <scope>test</scope>
        </dependency>
//json schema
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>json-schema-validator</artifactId>
            <version>4.2.0</version>
        </dependency>

参考

https://github.com/rest-assured/rest-assured/wiki/GettingStarted

版权所有,本文为原创文章,转载请注明出处

标签:assured,4.2,总论,rest,test,接口,io,spring,RestAssured
来源: https://www.cnblogs.com/liang6/p/14449230.html