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 provides flexibility to automate complex scenarios.

It also 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

No comments:

Post a Comment

Java Program 6: How to reverse a String in Java?

In this post we will discuss different methods to reverse a String in java programming. Method 1: Step 1: Read the input string using ...