REST-assured

码农软件 · 软件分类 · REST/RESTful项目 · 2019-03-10 20:28:53

软件介绍

用于方便REST服务测试的JAVA DSL

举例如下:

Here's an example of how to make a GET request and validate the JSON or XML response:

get("/lotto").then().assertThat().body("lotto.lottoId", equalTo(5));

Get and verify all winner ids:

get("/lotto").then().assertThat().body("lotto.winners.winnerId", hasItems(23, 54));

Using parameters:

given(). param("key1", "value1"). param("key2", "value2"). when(). post("/somewhere"). then(). body(containsString("OK"));

Using X-Path (XML only):

given(). parameters("firstName", "John", "lastName", "Doe"). when(). post("/greetMe"). then(). body(hasXPath("/greeting/firstName[text()='John']")).

Need authentication? REST Assured provides several authentication mechanisms:

given().auth().basic(username, password).when().get("/secured").then().statusCode(200);

Getting and parsing a response body:

// Example with JsonPath 
String json = get("/lotto").asString() 
List<String> winnderIds = from(json).get("lotto.winners.winnerId"); 
// Example with XmlPath 
String xml = post("/shopping").andReturn().body().asString() 
Node category = from(xml).get("shopping.category[0]");

REST Assured supports the POST, GET, PUT, DELETE, OPTIONS, PATCH and HEAD http methods and includes specifying and validating e.g. parameters, headers, cookies and body easily.

本文地址:https://codercto.com/soft/d/1067.html

编程匠艺

编程匠艺

Pete Goodliffe / 韩江、陈玉 / 电子工业出版社 / 2011-11 / 85.00元

如果你可以编写出合格的代码,但是想更进一步、创作出组织良好而且易于理解的代码,并希望成为一名真正的编程专家或提高现有的职业技能,那么Pete Goodliffe编写的这本本书都会为你给出答案。本书的内容涵盖编程的各个要素,如代码风格、变量命名、错误处理和安全性等。此外,本书还对一些更广泛的编程问题进行了探讨,如有效的团队合作、开发过程和文档编写,等等。本书各章的末尾均提供一些思考问题,这些问题回顾......一起来看看 《编程匠艺》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码