Using REST test libraries with Jupiter

REST APIs are becoming more and more pervasive nowadays. For that reason, a proper strategy for assessing REST services is desirable. In this section, we are going to learn how to use several test libraries in our JUnit 5 tests.

First of all, we can use the open source library REST Assured (http://rest-assured.io/). REST Assured allows the validation of REST services by means of a fluent API inspired in dynamic languages such as Ruby or Groovy. To use REST Assured in our test project, we simply need to add the proper dependency in Maven:

<dependency>   <groupId>io.rest-assured</groupId>   <artifactId>rest-assured</artifactId>   <version>${rest-assured.version}</version>   <scope>test</scope></dependency>

Get Mastering Software Testing with JUnit 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.