Book Image

Cucumber Cookbook

By : Shankar Garg
Book Image

Cucumber Cookbook

By: Shankar Garg

Overview of this book

Table of Contents (13 chapters)
Cucumber Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Building a REST Automation framework


HTTP Client is an open source REST services library developed by Apache. I am using HTTP Client for this framework because this is a pure Java implementation and is very easy to use. We need to create an instance of the HTTP client and then just use one of the already defined functions.

Since there is no UI involved and there is a limit to the functions that we need to use, there is no need for the POM in this framework. Let's learn how we can create a robust REST automation framework using Cucumber and HTTP Client.

Note

I am just giving a demo of REST Services automation, the same project and framework can be used for SOAP automation as well.

How to do it…

Let's first understand the test case that we will use in this framework. I am going to test the GET and POST methods. Let me walk-through the test Steps.

  1. Send a GET request to the GitHub URL at https://api.github.com/users/ShankarGarg to verify the user details.

  2. Send a POST request to the Apple service center...