Specification Builder

In this lesson, we would learn about creating specification in Rest Assured.

What is a specification?

In order to avoid duplicate request parameters and/or response expectations for multiple tests, we can create specification objects which are reusable.

There are two types of specification builder Java classes as mentioned below:

  1. RequestSpecBuilder
  2. ResponseSpecBuilder

RequestSpecification

This is used when a few common parameters are needed for multiple and/or different tests while creating a request.

Let’s understand this concept better with the help of a sample code snippet for creating a RequestSpecification using RequestSpecBuilder.

Get hands-on with 1400+ tech skills courses.