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.
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:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>3.2.0</version>
<scope>test</scope>
</dependency>
</dependencies>
This will add to our framework:
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:
@Test
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!
Comments