REST Assured

Build Status Maven Central Javadoc

Testing and validating 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. For example, if your HTTP server returns the following JSON at “http://localhost:8080/lotto/{id}”:

{
   "lotto":{
      "lottoId":5,
      "winning-numbers":[2,45,34,23,7,5,3],
      "winners":[
         {
            "winnerId":23,
            "numbers":[2,45,34,23,3,5]
         },
         {
            "winnerId":54,
            "numbers":[52,3,12,11,18,22]
         }
      ]
   }
}

You can easily use REST Assured to validate interesting things from the response:

@Test public void
lotto_resource_returns_200_with_expected_id_and_winners() {

    when().
            get("/lotto/{id}", 5).
    then().
            statusCode(200).
            body("lotto.lottoId", equalTo(5),
                 "lotto.winners.winnerId", hasItems(23, 54));

}

Looks easy enough? Why not give it a spin? See getting started and usage guide.

Fork me on GitHub

News

News

  • 2019-10-02: REST Assured 4.1.2 is released. It adds support for Java 13 as well as fixing some issues with the kotlin extension module. Please see change log for details.
  • 2019-09-06: Johan elaborates on some of the benefits of using the new Kotlin API in this blog post.
  • 2019-09-06: REST Assured 4.1.1 is released. This is a very small release containing updates to jaxb-osgi and jaxb-apo dependencies which could lead to classpath inconsistencies if using newer versions of jaxb in Java 9+. Please see change log for details.

Click here for older news.

Release Notes
Docs
Who

Who

REST Assured is developed and maintained by Johan Haleby with the help of numerous other contributors over the years. Would you like to contribute to the project in any way? Submit a pull request or contact Johan at Twitter.

Johan started the project when he was working at Jayway back in December of 2010. The project is now sponsored by Parkster.