百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

rest-assured

> 编程语言
开源

用于轻松测试 REST 服务的 Java DSL

7.1K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

用于轻松测试 REST 服务的 Java DSL

Testing and validation of REST services in Java is harder than in dynamic languages such as Ruby and Groovy. REST Assured brings the simplicity of using these languages into the Java domain.

News

  • 2026-07-10: REST Assured 6.0.1 is released. The Spring modules now target Spring 7 and no longer pull their own Spring version onto your classpath, so they work on Spring Boot 4 without manual exclusions. It also rounds out Jackson 3 support and fixes a few bugs. See change log for more details.
  • 2026-01-16: REST Assured 5.5.7 is released with backported support for Spring framework 7 MockMvc support. See change log for more details.
  • 2025-12-12: REST Assured 6.0.0 is released. It raises the baseline to Java 17+, upgrades to Groovy 5, adds Spring 7 + Jackson 3 support (and bumps minimum versions for Spring/Yasson/Johnzon). See release notes and change log for more details. more details.

Older News

Examples

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().
    params("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> winnerIds = 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 any HTTP method but has explicit support for POST, GET, PUT, DELETE, OPTIONS, PATCH and HEAD and includes specifying and validating e.g. parameters, headers, cookies and body easily.

Documentation

  • Getting started
  • Usage Guide (click here for legacy documentation)
  • Javadoc
  • Rest Assured Javadoc
  • Rest AssuredMockMvc Javadoc
  • XmlPath Javadoc
  • JsonPath Javadoc
  • Release Notes
  • FAQ

Support and discussion

Join the mailing list at our Google group.

Links

  • Change log
  • REST Assured on openhub
  • Mailing list for questions and support

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Javagroovyhttpjavajson

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言