REST Assured -Setting up environment using Maven

This entry is part 4 of 14 in the series REST Assured Tutorial

To start building code for our REST API automation testing, we will setup our environment using two different ways, using rest assured with Maven dependencies and by configuring external jar files for REST-Assured. If you are familiar with maven you can skip this page and directly go to the next tutorial.

If you dont have maven already installed, please visit this maven installation guide How To Install Maven

Lets see how to setup Rest Assured using Maven :

I am using Eclipse Neon here, you can use any version you are comfortable with. Please make sure you have an internet connection before creating a maven project, the dependencies will get automatically downloaded from maven central repository over the internet.
Open Eclipse and Click on File – New – Project.
Select Maven – Maven Project as below :

Click next. Following window will appear :

Click on Create a simple project(skip archetype selection)

Click Next. Following window will appear :

Fill the required information as above.

Click Finish. Your project will be created as below :

 

Make sure pom.xml is created. We need to add maven dependenices in pom.xml file.

Maven Dependencies
You just need to copy the code from this below snippet and paste it inside your pom.xml file. This code will download all the jars we need to perform REST API testing using REST-Assured, you do not need to worry about searching correct jars, all will be taken care by Maven, please notice Maven Dependencies folder have many jars in it now, those jars are downloaded by Maven in your workspace.

Your pom.xml file will look like below after pasting the above code in the file. Once you hit Save button, Maven will start downloading all the dependencies of rest-assured.

Congratulations you successfully created your Maven project. In next tutorial we will see how to setup environment without using Maven. Please drop a comment below if you face any issues in the setup. We would be glad to help.

 

Series Navigation<< Introduction to REST-API and REST-AssuredSetting up environment without Maven >>