Monday, July 1, 2019

API Testing 06: Introduction REST- assured and creating a REST-assured - Maven project

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 for API testing. REST-assured provides many in-built functions, those functions provides flexibility to automate complex scenarios. It also supports integration with plugins like Hamcrest for easy response validations.

It supports BDD style scripting, which increases the readability. 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:

Create a Maven project in IntelliJ IDE and add the Maven dependencies of REST-assured, JSON Path and TestNG in pom.xml.

BDD Style in REST-assured:

Rest-assured 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. Some of the keywords are discussed below
  • 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
  • Scenario: It is used for describing the test case
  • Background: This is used for executing the pre-requisite steps of each scenarios.
In the next tutorial we will learn about writing the our first test case using REST-assured in BDD style.

#HappyLearning #HappyTesting


  1. This comment has been removed by the author.

  2. I will prefer this blog because it has much more informative stuff. Visit Google Search Api for more related information and knowledge.

  3. Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging.. Pentest

  4. I am truly impressed by the details which you have provided regarding API testing and U231748506 mystery code It is an interesting article for me as well as for others.


DevOps 01: What is DevOps and How it benefits organizations?

DevOps is a culture in an organization, where the development team and operations team help each other by sharing information, process and t...