Setting up RestAssured

Course Home | POM Example | Code Example

Before we begin to create our Rest-Assured tests we need to get test runner and libraries setup and configured.

Setup and configure Maven

We will be using Maven to manage our dependencies and structure our framework, if you’re not familiar with Maven I would recommend you check out this course to get to grips with it.

First off, using your IDE, create an empty Maven project and add the following dependencies to the pom.xml:


This will add to our framework:

  • JUnit - To run Rest-assured based tests we need a test runner. JUnit will allows us to create tests and run them once ready.
  • Rest-assured - The main library for this course! This library contains everything we need to create an API request.

Create a test to confirm configuration

As stated earlier we are using JUnit to create our test. So let’s leverage JUnit to confirm both libraries are installed correctly.

Start by creating a test class named ApiTest in the src/test/java folder and then add the following test in your class:

public void myFirstRaTest(){
    assertThat(RestAssured.config(), instanceOf(RestAssuredConfig.class));

Run the test. If it passes this confirms you have everything installed and you are ready to get automating with RestASsured!

Next Lesson ➔

Mark Winteringham's photo

Mark Winteringham


Mark Winteringham is a tester, toolsmith and the Ministry of Testing DojoBoss with over 10 years experience providing testing expertise on award-winning projects across a wide range of technology sectors including BBC, Barclays, UK Government and Thomson Reuters. He is an advocate for modern risk-based testing practices and trains teams in Automation in Testing, Behaviour Driven Development and Exploratory testing techniques. He is also the co-founder of Software Testing Clinic a community raising awareness of careers in testing and improving testing education. You can find him on Twitter @2bittester.