Automate Coronavirus COVID19 REST API GET METHOD Tutorial Part1




1. Understanding REST & REST Assured API

REST stands for Representational State Transfer mainly uses the http protocol to exchange messages
between client and server using different methods such as GET,POST,PUT,DELETE.

Example :
COVID19 API Website Details
COVID19 API Details

Request Details::

  • REST API EndPoint: https://api.covid19api.com/
  • Method Type: GET
  • Request Headers:
    authority: api.covid19api.com
  • Query Params:

    https://getAllEmployees&empID=1

Response Details::

  • Response Code:200
  • Response Headers:content-type: application/json; charset=UTF-8
  • Response Body:{“allRoute”:{“Name”:”Get All Data”}}

2. Design Test-cases

Rest API Testcases

3. Pre-requisites for Automation REST Services:

com.jayway is a older version
io.restassured is the latest version
Eclipse
Maven project
pom.xml
io.restassured dependency
groupId: io.rest-assured
artifactId: rest-assured
version: 4.3.0

TESTNG – validate the test results

4. Get Method example
RestAssured

  • Response Code Validation
  • Response Headers Validation
  • Response Body Validation

Java Logic

Conclusion:
Validated Response Code
Validated Response Headers
Validated Response Body

REST API Results

COVID19 REST API Results

Leave a Reply

Your email address will not be published. Required fields are marked *