REST-assured

程序名称:REST-assured

授权协议: Apache

操作系统: 跨平台

开发语言: Java

REST-assured 介绍

用于方便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.

REST-assured 官网

https://github.com/jayway/rest-assured

相关编程语言

MuPlayer 是一款跨平台、轻量级的音频播放解决方案,...
OS FLV 是一个 开源和可嵌入网页的flv播放器。 这个...
DewPlayer音乐播放器,样式很简单,而且很实用.播放器...
JW FLV MEDIA PLAYER是一个开源的在网页上使用的Fla...
Speakker 是一个基于 Web 浏览器的音乐播放器,只提...
Player Framework 是一个开源的支持 HTML5 的视频播...