DEV Community

Cover image for Rest Assured E2E Testing - Part 3
TaheraFirdose
TaheraFirdose

Posted on

Rest Assured E2E Testing - Part 3

Setup A Basic REST Assured Maven Project In Eclipse IDE

In this post we will learn to setup a Maven – REST Assured in Eclipse IDE.

Pre-requisites

To begin your project, you must have the following installed and configured on your computer.
Java and Eclipse IDE •
TestNG which is unit testing framework •
Maven (either we can add jar file manually to our project or we can create a maven project)

Lest’s get started with creating the project.

Creating Maven Project in Eclipse

  1. Open eclipse and click on File> New> Project
    image

  2. In the wizard text box, type Maven and then select Maven from the list box, as shown below. Click the Next> button.

image

  1. Click on Next button(select maven-archetype-quickstart)
    image

  2. Type in the Group Id and Artifact Id (You can give any name to that) and click Finish button
    image

  3. Finally, the Maven Project “RESTAssured_APITesting” is successfully created. Please keep in mind that this Maven project generates pom.xml, as highlighted and shown below.
    image

  4. Add dependency of rest assured in pom.xml. For getting maven dependency, visit Maven Repository.

    image

  5. Add Maven dependency of TestNG/Junit in your framework. These tests framework will help in managing tests. TestNG is preferable as compared to Junit because of additional features in TestNG. You can copy the dependency from Maven Repository and then paste it in pom.xml.

image

  1. Add Maven dependency of Jackson JSON java parser and JSON Schema Validator in pom.xml. JSON Schema Validator will be used to validate JSON Schema while JSON java parser will be used for parse JSON to map java objects to and from JSON. image

image

  1. Install hamcrest Assertion
    image

  2. After adding all the dependencies, the final pom.xml will look just like below.
    image

  3. After successful addition of dependencies, you will see JAR files in Maven dependencies in your project structure.

image

Discussion (0)