LOUISVILLE, KENTUCKY
ATLANTA, GEORGIA
CHICAGO, ILLINOIS
CINCINNATI, OHIO
DENVER, COLORADO
HARRISBURG, PENNSYLVANIA
MADISON, WISCONSIN
RARITAN, NEW JERSEY
TORONTO, ONTARIO
BANGALORE, INDIA
HYDERABAD, INDIA

V-Soft's Corporate Headquarters

101 Bullitt Lane, Suite #205
Louisville, KY 40222

502.425.8425
TOLL FREE: 844.425.8425
FAX: 502.412.5869

Denver, Colorado

6400 South Fiddlers Green Circle Suite #1150
Greenwood Village, CO 80111

TOLL FREE: 844.425.8425

Chicago, Illinois

5215 Old Orchard Road Suite #950
Skokie, IL 60077

TOLL FREE: 844.425.8425

Madison, Wisconsin

8401 Greenway Boulevard Suite #100
Middleton, WI 53562

TOLL FREE: 844.425.8425

Harrisburg, Pennsylvania

4813 Jonestown Road Suite #103
Harrisburg, PA 17109

TOLL FREE: 844.425.8425

Atlanta, Georgia

1255 Peachtree Parkway Suite #4201
Cumming, GA 30041

TOLL FREE: 844.425.8425

Cincinnati, Ohio

Spectrum Office Tower 11260
Chester Road Suite 350
Cincinnati, OH 45246

Phone: 513.771.0050

Raritan, New Jersey

216 Route 206 Suite 22 Hillsborough Raritan, NJ 08844

Phone: 513.771.0050

Toronto, Canada

1 St. Clair Ave W Suite #902, Toronto, Ontario, M4V 1K6

Phone: 416.663.0900

Hyderabad, India

Incor 9, 3rd Floor, Kavuri Hills
Madhapur, Hyderabad – 500033 India

PHONE: 040-48482789

Bangalore, India

GINSERV, CA Site No 1, HAL
3rd Stage Behind Hotel Leela Palace
Kodihalli, Bangalore - 560008 India

API Testing Process Using REST Assured and PostMan Tool

Platforms and Browsers Supported by Selenium

APIs stand as enablers to conduct risk-free legacy modernization and drive businesses toward digital transformation. APIs should be precisely optimized to fulfill a specific business request in a specific context. To ensure a robust API, API testing is the key to success. API testing can be performed either manually using POSTMan tools or by automation using available dependency code for Rest Assured. 

What is REST Assured?

The objective of REST Assured is to simplify the process to test and validate RestAPI. Rest Assured is a Java-based library used to validate HTTP responses received from the server. For example, we can verify the Status Code, Status Message, Headers and the Body of the response. This flexibility of the REST Assured library can be used for testing.

Example of Rest Assured API Testing Tool

 

Dependency Code used for Test Automation

 

Comparing Operations in Rest-Assured and Manual API testing in POSTMAN

Generally four basic operations are performed using the REST interface: Create, Read, Update and Delete. These four collectively termed as CRUD operations. All these operations are performed either manually using tools like POSTMAN or automated using Rest-Assured or Rest API libraries.

Let's look at the CRUD in detail:

Create Operation Performed Using the POST or post() Method

  • Using the post(), we can perform changes to the server.
  • Here, resources are created on the server and hence, the changes are done to the server.
  • Example: Uploading the picture on Facebook where we perform the changes to the Server on top of the existing resources.
  • Status Code of the Response received is 201.
  • Reason Phrase is “Created”.
  • Code Snippet:                                                                                                         Example code of making changes to serving using post()

Example 1: Post Response (from Postman)

Computer Code Post Response(from Postman)

Example 2: Post Response (from Postman)                                                                        Post Response(from Postman)

Read Operation Performed Using the GET or get() Method.

  1. Using the get(), data is retrieved from the server.
  2. Here, no changes are made to the server or to already existing resources.
    Example: Simple search on Google where we don't alter anything.
  3. Status Code of the Response received is 200.
  4. Reason Phrase is “OK”.
  5. Code Snippet:

Example of Read Operation using get():

Example 1: Get Request (from Postman)

Get Request( from Postman)

Example 2: Get Response (from Postman)

Get Response( from Postman)

Update Operation Performed Using the PUT or put() Method

  1. Using the put(),we can perform changes to the server on updating.
  2. Here, resources are updated on the server and hence, the changes are done to the server.
    Example: Changing or updating a picture on Facebook where we perform the changes to the server on top of the existing resources.
  3. Status Code of the Response received is 200.
  4. Reason Phrase is “OK”
  5. Body of the request is required and the Path/URL is given for the exact resource to be updated. For example, http://localhost:3000/posts/1 is to be provided to remove the resource with id=1

7. Code Snippet:                                                                            Code Snippet of Update operation

Example 1: PUT Request (From Postman)                                                               PUT Request(From Postman)

Example 2: PUT Response (From Postman)                                                      PUT Response(From Postman)

Delete Operation Performed Using the DELETE or delete() Method

  1. Using the delete(),we can delete the existing resources on the server.
  2. Here, resources are deleted on the server.
    Example: Deleting the picture on Facebook where we delete the resource
  3. Status Code of the Response received is 204.
  4. Body of the request is not required and the Path/URL is given for the exact resource to be removed. For example, http://localhost:3000/posts/1 is to be provided to remove the resource with id=1
  5. Code Snippet:

Delete operation Code Snippet


Delete Request (From Postman)                                                                               Delete Request(From Postman)

Example 2: Delete Response (From Postman)

Delete Response (From Postman)

Conclusion

The above information related to API testing using the Rest-Assured and Postman tool clearly differentiates both Manual Testing and Test Automation roles. Moreover, it depicts how REST Assured simplifies the process to test and validate RestAPI without any complexities.

 

About Author

Sandya ChittiSandya Chitti N works as a Senior Test Automation Engineer with V-Soft Consulting and has more than 8 years of IT experience in Software Testing and around 4 years of experience as an Automation QA Engineer using Selenium WebDriver. She has sound testing knowledge in Rest API testing, Web & Mobile App (Android & iOS) testing, GUI, Functional, Integration, System, Ad-hoc, Usability, Data Base, Smoke, Regression and Retesting. In her quality testing career, she has  learned alot about Selenium IDE, WebDriver and OATS automation Testing Tools. She is also well versed in programming C, SQL, Core Java, JavaScript and Python.

Topics: QA TCOE, RESTAPI, API Testing, PostMan Tool, REST Assured

Get Weekly Updates

New call-to-action