首页 > 其他 > 详细

RestAssured测试接口(1)- 总论

时间:2021-02-25 23:56:19      阅读:36      评论:0      收藏:0      [点我收藏+]

概述

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

功能

  • 使用RestAssured进行接口测试
  • 使用RestAssured封装底层接口驱动

官网

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

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

RestAssured测试接口(1)- 总论

原文:https://www.cnblogs.com/liang6/p/14449230.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!