Sample Rest API To Test With Rest Assured

What we have learned so far?

Part 1 – What is Rest Assured? How to setup Rest Assured?
https://www.onlyfullstack.com/what-is-rest-assured-how-to-setup-rest-assured/

Sample Rest API to do Testing for Rest Assured

In this post we will explore the rest api which we will be using through out this tutorial to learn the Rest API automation. We have created the rest api of employee where we can get the details of an employee, save an employee, update an employee and delete an employee. Please follow below steps to start and use this rest api application on your system.

1. Clone the below repository
git clone https://github.com/onlyfullstack/rest-assured-tutorial.git
This will clone th repository in your local system.
Repository Link – https://github.com/onlyfullstack/rest-assured-tutorial

2. Run the application
This repository contains the rest api code inside src/main folder and all Rest Assured tests under src/test folder. You can import the project in eclipse and run the RestAssuredApplication.java files main method.
Or
Navigate to rest-assured-tutorial from Command Prompt and hit below maven command to start the application locally.
mvn spring-boot:run
3. Install the Postman
You can download the postman from below link –
https://www.postman.com/downloads/

Import the postman collection as below
Go to File -> Import -> Choose Files and navigate to rest-assured-tutorial/ and select OnlyFullStack_Employee.postman_collection.json collection file.
https://github.com/onlyfullstack/rest-assured-tutorial/blob/master/OnlyFullStack_Employee.postman_collection.json

import postman rest assured tutorial onlyfullstack
This will import the collection of employee rest api with all the supported operations.
import 2 postman rest assured tutorial onlyfullstack

Now go to your postman and hit the requests as you wish.

HTTP Method
Request Name
Description
GET
Get All Employees
Get All Employees from the database
GET
Get Employee
Get an Employees from employee id
POST
Save Employee
Saves new Employee into database
PUT
Update Employee
Updates an Employee into database
DELETE
Delete Employee
Deletes an Employee from database

Get All Employees

1 get allhttp method postman rest assured tutorial onlyfullstack

Get Employee

get http method postman rest assured tutorial onlyfullstack

Save Employee

1 post http method postman rest assured tutorial onlyfullstack

Update Employee

put http method postman rest assured tutorial onlyfullstack

Delete Employee

delete http method postman rest assured tutorial onlyfullstack

Try the employee api form postman and perform all 5 operations as we are going to automate the api testing with Rest Assured.

Lets go to our next tutorial where we will discuss below points :

Part 3 – How to make a GET Request using Rest Assured

– What is HTTP?
– What are different types of HTTP method?
– What is GET? How to make get request in Rest Assured?
– Rest assured get api automation without BDD approach
– Rest assured get api automation with BDD approach
https://www.onlyfullstack.com/how-to-send-get-request-in-rest-assured/

Source Code
You can find the complete source code on below GitHub repository – 
https://github.com/onlyfullstack/rest-assured-tutorial

Rest Assured Tutorial
https://www.onlyfullstack.com/rest-assured-tutorial-for-beginners/