背景:
一次偶然的机会,看到Learn Rest Assured系列文章,觉得里面的文章写得非常好,对Rest Assured的基础知识介绍的通俗易懂,所以决定参考里面的内容,加上自己的一些理解,就 拷贝+翻译+加工 地搬过来了。我曾发过邮件给原作者,但是一直没得到回复,希望原作者如果看到我这些文章,请原谅我的盗版:), 我是觉得好东西大家分享,互相学习。
这个系列会每周更新,对自己来说是对Rest Assured基础理论加实践的梳理,受益匪浅,也希望这些文章能够对从事软件测试的同行们有些帮助,更希望能得到同行的指正和交流。
建议API测试初学者在阅读此系列之前可以先看看《API Testing 入门基础系列》对API Testing有个最基础的了解。
系列大纲:
Topic:REST Assured 介绍
REST Assured 1 - REST Assured 介绍
REST Assured 2 - 用IDEA创建一个基本的REST Assured Maven项目
Topic:Java 的静态导入
REST Assured 3 - Static Import In Java
Topic:第一个 HTTP GET 请求
REST Assured 4 - 第一个GET Request
Topic:抽象和接口的概念
REST Assured 5 - Abstraction抽象,隐藏实现
REST Assured 6 - Interface接口,实现你所想
Topic:Java 中的链式调用及 BDD 风格
Topic: HTTP 方法请求
REST Assured 9 - 第一个POST Request
REST Assured 10 - 第一个PUT Request
REST Assured 11 - 第一个PATCH Request
REST Assured 12 - 第一个DELETE Request
Topic:response 写入 JSON 文件
REST Assured 13 - API Response写入JSON文件
Topic:RequestSpecification 用来设置共同的 request 参数
REST Assured 14 - RequestSpecification
REST Assured 15 - RequestSpecification Call Http方法
REST Assured 16 - RequestSpecBuild
REST Assured 17 - 设置默认的RequestSpecification
REST Assured 18 - Querying RequestSpecification
Topic:默认的主机和端口
REST Assured 19 - Default Host And Port
Topic:JSON/XML 文件作为 payload
REST Assured 20 - JSON/XML File As Payload
Topic:Response 时间
REST Assured 21 - Response Time
Topic:Java 创建 JSON payload
REST Assured 23 - 用Java Map创建JSON Object Request Body
REST Assured 24 - 用List创建JSON Array Request Body
Topic:Jackson API 的 ObjectMapper 创建 JSON payload
REST Assured 25 - 用Jackson API的ObjectMapper类创建JSON Object
REST Assured 26 - ObjectNode作为request的payload
REST Assured 27 - 用Jackson API的ObjectMapper类创建JSON Array
Topic:创建POJO 类作为 JSON Payload
REST Assured 28 - 什么是Plain Old Java Object (POJO) ?
REST Assured 29 - 创建POJO 作为一个JSON Object Payload
REST Assured 30 - 创建 POJO 作为一个JSON Array Payload
REST Assured 31 - 创建POJO作为A Nested JSON Payload
Topic:用 Jackson API 序列化/反序列化 JSON Object
REST Assured 32 - 利用Jackson API将Java Object Serialization序列化成 JSON Object
REST Assured 33 - 利用Jackson API 将JSON Object De-Serialization反序列成 Java Object
Topic:用 Gson API 序列化/反序列化 JSON Object
REST Assured 34 - 利用Gson API将Java Object Serialization系列化成 JSON Object
Topic:用 Jackson API 序列化/反序列化 JSON object 忽略某些字段
REST Assured 35 - 利用Gson API 将JSON Object De-Serialization反序列化成 Java Object
REST Assured 36 - @JsonInclude Annotation - Payload中忽略默认值字段
REST Assured 37 - @JsonInclude Annotation – Payload 中忽略值为Null & Empty Values的字段
REST Assured 38 - POJO 的 Getter & Setter 方法如何影响 Serialization 系列化 & Deserialization 反序列化
REST Assured 39 - @JsonIgnore Annotation – Serialization 和 Deserialization 移除某些字段
REST Assured 40 - @JsonIgnoreProperties Annotation – Serialization Or Deserialization Or Both 移除字段
REST Assured 41 - @JsonIgnoreProperties Annotation - Deserialization 忽略 Unknown Properties
REST Assured 42 - 利用Jackson API ObjectMapper – Deserialization 忽略 Unknown Properties
Topic:用Jackson 库的 JsonNode 解析 JSON response
REST Assured 43 - Get All Keys From A Nested JSON Object
REST Assured 44 - Fetch Value From JSON Object Using JsonNode – Jackson – Get() & Path() Methods
REST Assured 45 - Fetch Value From Nested JSON Object Using JsonNode – Jackson – At() Method
REST Assured 46 - Fetch Value From JSON Array Using JsonNode – Jackson – Get() & Path() Methods
REST Assured 47 - Fetch Value From Nested JSON Array Using JsonNode – Jackson – At() Method
Topic:有关 Headers 的设置和获取
REST Assured 48 - How To Pass Headers In Rest Assured Requests
REST Assured 49 - How To Retrieve Single And MultiValue Headers From Response Using Rest Assure
REST Assured 50 - How To Set Content-Type For Request In Rest Assured
REST Assured 51 - How To Retrieve And Assert Content-Type Of Response In Rest Assured
Topic:ResponseSpecification 用于一组通用的 response 断言
REST Assured 52 - ResponseSpecification – Specify How The Expected Response Must Look Like
REST Assured 53 - How To Create ResponseSpecification Using ResponseSpecBuilder
Topic:JSON Schema 用来验证 JSON repose 的语义和语法
REST Assured 54 - What Is JSON Schema?
REST Assured 55 - JSON Schema Validation In Rest Assured
REST Assured 56 - JSON Schema Validation Without Rest Assured
Topic:用 Jackson 库的 JsonNode 编辑 JSON Objects,不用创建 POJO 类
REST Assured 57 - Editing Existing JSON Object On The Fly Using JsonNode – Jackson
Topic:用 JsonPath 解析 JSON response
REST Assured 58 - What Is JsonPath And How To Create It For Simple And Nested JSON Object?
REST Assured 59 - How To Create JsonPath For Simple And Nested JSON Array?
REST Assured 60 - Learn To Write JsonPath Expressions Or JsonPath Syntax
REST Assured 61 - Deserialize Using JsonPath
Topic:参数化 URL
REST Assured 62 - How To Use Path Or URL Parameters In Rest Assured
Topic:创建带日期字段的 JSON
REST Assured 63 - How To Create JSON With Date Fields Using POJO
Topic:TestNG API 间共享上下文
REST Assured 64 - How To Pass Value From One API To Another API Using TestNG – ITestContext
Topic:Rest Assured 解析并断言整个 JSON response
REST Assured 65 - How To Parse A JSON Object Response To A Java Map In Rest Assured?
REST Assured 66 - How To Parse A JSON Array Response To A Java List In Rest Assured?
REST Assured 67 - How To Assert Full Response JSON Body In Rest Assured?
Topic:Jackson 库 JsonNode 比较两个 JSONs,用于 JSON response 断言
REST Assured 68 - Compare Two JSON Using Jackson – Java Library
Topic:JsonAssert 库比较两个 JSONs,用于 JSON response 断言
REST Assured 69 - Introduction To JsonAssert Library
REST Assured 70 - Compare JSON Objects Using JSONassert Library
REST Assured 71 - Compare JSON Arrays Using JSONassert Library
REST Assured 72 - How To Compare Part Of JSON Objects And Arrays Using JSONassert Library
REST Assured 73 - How To Ignore Node/S For JSON Comparison In JSONassert
REST Assured 74 - Problem With JSONassert While Ignoring Fields From JSON Documents