REST Assured: a Java DSL for testing REST services, and where it stops fitting
Java DSL for easy testing of REST services
At a glance
- What is it?
- REST Assured wraps HTTP calls and response assertions in a Groovy-flavoured Java DSL. It is a good fit for JVM test suites that need to check JSON and XML payloads, and a poor fit if you want a general-purpose HTTP client or a non-JVM stack.
- Who is it for?
- Adopt REST Assured if your tests already run on the JVM and you need to assert against JSON or XML bodies without hand-writing a client. Do not adopt it as a production HTTP client, and do not adopt it if you are pinned below Java 17, since the 6.x line raises that baseline.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 70 days ago.
- What is it written in?
- Mainly Java, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.
Editorial analysis
The problem REST Assured solves for JVM teams
The README states the motivation plainly: testing and validating REST services in Java is harder than in dynamic languages such as Ruby and Groovy, and REST Assured brings the simplicity of those languages into the Java domain. That is the whole pitch. In a plain Java test you assemble a request object, execute it, capture the response, deserialize the body, and then write assertions against the deserialized structure. REST Assured collapses those steps into one chain.
The target user is a Java or Kotlin developer writing integration or API tests, typically inside JUnit or another JVM test runner. The repository layout confirms this focus: the examples directory contains rest-assured-itest-java, kotlin-example, scala-example, scala3-example, and several Spring MVC webapps, including spring7-mvc-webapp. There is no server component and no runtime to deploy. It is a library that lives in your test scope.
If you are writing a load generator, a CLI for poking endpoints, or a production HTTP client, this is the wrong tool. REST Assured is built around assertions and readable test code, not around connection pooling policy or throughput tuning.
How the given/when/then chain and the path syntax work
The mechanism is a fluent builder. The README's examples show the shape: a given() block for request setup, a when() block for the HTTP method and path, and a then() block for assertions. Parameters, headers, cookies and body are all specified in the given() block, and the README notes explicit support for POST, GET, PUT, DELETE, OPTIONS, PATCH and HEAD while stating that any HTTP method is supported.
The part that carries the most weight is the body path syntax. Instead of deserializing into a POJO and asserting on getters, you write a path expression that walks the response document directly. The README gives this example, which asserts on a nested JSON field:
get("/lotto").then().assertThat().body("lotto.lottoId", equalTo(5));The same dot notation covers collections. This example checks that a list contains specific values:
get("/lotto").then().assertThat().body("lotto.winners.winnerId", hasItems(23, 54));For XML, the DSL switches to XPath rather than dot paths. The README shows a POST with parameters followed by an XPath assertion:
given().
params("firstName", "John", "lastName", "Doe").
when().
post("/greetMe").
then().
body(hasXPath("/greeting/firstName[text()='John']")).There is also a separate extraction route when you want the raw payload rather than an assertion. The README shows pulling a string out of a GET and then reading fields from it with JsonPath, and doing the same for XML with XmlPath:
String json = get("/lotto").asString();
List<String> winnerIds = from(json).get("lotto.winners.winnerId");
String xml = post("/shopping").andReturn().body().asString();
Node category = from(xml).get("shopping.category[0]");Authentication is handled inside the same chain. The README lists several mechanisms and gives basic auth as the concrete example:
given().auth().basic(username, password).when().get("/secured").then().statusCode(200);That is the entire data flow: build a request, execute it, and let the DSL read the response document through a path expression. Nothing is cached or proxied between the test and the service.
Installing REST Assured and writing a first test
REST Assured is published to Maven Central under the group and artifact io.rest-assured/rest-assured, which the README's Maven Central badge links to. The README does not print an install command, so the dependency coordinates are the starting point rather than a copied snippet. The repository also ships rest-assured-bom and rest-assured-all modules, so if you want every module aligned to one version, import the BOM rather than pinning each artifact. The README's own example blocks use the static DSL directly:
get("/lotto").then().assertThat().body("lotto.lottoId", equalTo(5));Version choice matters more than usual here. The release notes for 6.0.0 raise the baseline to Java 17 or later and upgrade to Groovy 5. If your build targets an older JDK, stay on the 5.x line. The 6.0.1 release, dated 2026-07-10 in the news section, makes the Spring modules target Spring 7 and stops them pulling their own Spring version onto your classpath, so they work on Spring Boot 4 without manual exclusions.
What you should see when that example runs is a passing test if the response contains a lotto object with a lottoId of 5, and an assertion failure showing the actual value if it does not. The README does not document a base URI configuration step in the excerpt, so for a real service you will need to set the target host before this call means anything.
Where REST Assured gets in the way
The dot-path assertions are the feature and the liability. They are strings, so a renamed JSON field is a runtime failure rather than a compile error, and an IDE cannot navigate from "lotto.winners.winnerId" to the class that produced it. Teams that want refactoring safety end up deserializing into POJOs and asserting on typed objects, which gives back much of the verbosity the DSL was meant to remove.
Groovy is a second constraint. The 6.0.0 release notes upgrade to Groovy 5, and the README describes the project as bringing dynamic-language simplicity into Java. That means a Groovy dependency sits under your tests, and version conflicts with a Groovy version already used elsewhere in the build are a realistic problem rather than a hypothetical one.
The Spring modules are a third. The 6.0.1 note about no longer pulling their own Spring version onto the classpath is a fix for a classpath problem that clearly existed, and it means the Spring integration is sensitive to which Spring generation you are on. If you are not on Spring 7 or Spring Boot 4, the 6.0.1 Spring modules are not aimed at you.
Finally, scope. REST Assured asserts; it does not schedule, report, or run tests. It has no test runner of its own, so it is always a component inside JUnit, TestNG, or whatever else drives your suite.
REST Assured compared with a plain HTTP client plus an assertion library
The honest alternative is not another test DSL. It is the combination you already have: a general HTTP client for the JVM, plus your existing assertion library and a JSON or XML binding library. The difference is where the readability comes from.
With a plain client, you write the request construction and the response parsing yourself, then assert on the parsed object. That is more code, but every step is typed and navigable, and the HTTP client is the same one you use in production, so timeouts, retries and connection behaviour are configured once. With REST Assured, the request and the assertion are the same expression, which is shorter but couples your test's readability to a path string.
A second difference is language reach. REST Assured is a JVM library. The repository ships Kotlin and Scala examples, which shows the DSL is usable from those languages, but it does not extend to a Python or JavaScript test suite. If your organization runs API tests in more than one language, REST Assured will only cover the JVM portion, and the path syntax will not be portable to the others.
The trade-off is therefore concentrated: adopt REST Assured when the assertion readability is worth the string-based paths and the extra Groovy dependency. Skip it when type safety or cross-language consistency matters more than brevity.
Maintenance, version baseline and licence cost
The repository is not archived, and the last push was on 2026-07-22, so there is recent activity. The news section lists three releases in roughly seven months: 6.0.0 on 2025-12-12, 5.5.7 on 2026-01-16, and 6.0.1 on 2026-07-10. That cadence includes a backport release on the older line, which suggests the maintainers are still supporting users who have not moved to 6.x.
The upgrade cost is real and concentrated at the major version. Moving from 5.x to 6.x means Java 17 or later and Groovy 5, per the 6.0.0 release notes, plus minimum version bumps for Spring, Yasson and Johnzon. That is a build-wide change if you are on an older JDK, not a dependency bump. The 5.5.7 release exists precisely because that migration is not free for everyone.
The licence is Apache-2.0, stated in the repository and in the LICENSE file at the top level. That is a permissive licence with a patent grant, and it does not impose copyleft obligations on the code that depends on it. This is a description of the licence text, not legal advice; if you redistribute modified copies or bundle the library into a product, have your own counsel read the NOTICE and attribution requirements.
Editorial conclusion
Adopt REST Assured if your tests already run on the JVM and you need to assert against JSON or XML bodies without hand-writing a client. Do not adopt it as a production HTTP client, and do not adopt it if you are pinned below Java 17, since the 6.x line raises that baseline. Before committing, verify your Java and Groovy versions against the 6.0.0 release notes, and check whether your Spring modules need the 6.0.1 behaviour of no longer pulling their own Spring version onto the classpath.
Frequently asked questions
How do I install REST Assured in IntelliJ or Eclipse?
The README does not give IDE-specific install steps. REST Assured is published to Maven Central as io.rest-assured/rest-assured, so you add it as a test-scoped dependency in your build file and let the IDE import the Maven or Gradle project.
How do I use RequestSpecification in REST Assured?
The README shows the given() block as the place where request setup lives: parameters, headers, cookies, body and authentication are all specified there before the when() call. It does not use the term RequestSpecification in the excerpt, so the reusable specification object is documented in the Usage Guide rather than the README.
How do I use a POJO class in REST Assured?
The README's examples assert directly against response paths such as lotto.lottoId and lotto.winners.winnerId rather than deserializing into a POJO. It does show extracting a raw body with asString() and then reading fields with JsonPath or XmlPath, which is the route to take if you want to map into your own class.
How do I use REST Assured for API testing?
The README's examples chain given(), when() and then() to build a request and assert on the response, with body paths for JSON and hasXPath for XML. The Usage Guide linked from the README covers the full surface beyond those examples.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/rest-assured-rest-assured)