Tuesday, February 5, 2019

API Testing 04: Introduction to REST-assured and creating Rest-assured project using Maven

REST-assured is a java API for testing and validating the RESTful Web services in Java. It is developed and maintained by John Haleby with the help numerous open source contributors.

REST-assured is easy to understand, simple to use, yet very powerful API because it provides many in-built functions, flexibility to automate complex scenarios, BDD style scripting support and etc. With less scripting we can write powerful tests. We will see all the important features of REST-assured in upcoming tutorials.

Configuring REST-assured project:

Lets create a Maven project and add required dependencies in the pom.xml file. In this we are using TestNG framework to write the tests.

Create a Maven project in eclipse and add below Maven dependencies of REST-assured, JSON Path and TestNG in pom.xml as shown below.

BDD Style in REST-assured:

Rest-assured is uses an API that supports BDD style in writing the tests. This style increases the readability of the tests.

We will be using the tests using the Gherkin language keywords "Given-When-Then" as functions.

  • Given:  This takes given context, state or parameters of system
  • When: It looks for a state or condition to happen/when something happened
  • Then: It verifies the new state of the system or outcome
  • And: It is used for conjunction of more than one condition
In the next tutorial we will learn about writing the our first test case using REST-assured in BDD style.

#HappyLearning #HappyTesting

1 comment:

  1. REST API is a set of functions helping developers in performing requests along with receiving responses. Through HTTP protocol interaction is made in REST API.

    The term REST refers to Representational State Transfer. In very short span of time, it has become an effective standard for API creation.

    Thanks for sharing such a valuable post and Keep Sharing !!!!

    API testing blog


Katalon 08: Integration of HP ALM with Katalon Studio

In this post, this post we discuss about integration of  HP ALM with Katalon Studio. If we can integrate HP ALM with Katalon we can update ...