REST API Testing in Serenity BDD


REST APIs are an increasingly important part of modern software architectures. And in a world where speedy delivery is of the essence, comprehensive automated tests are not an option. 

From a testing perspective, understanding REST APIs and how to use them is vital, even if you aren't writing tests for an API directly. Testers can reduce the need for slow and expensive automated web tests by using REST APIs to bypass the web UI layer for test preparation or for verifying test results, or in cases where repeatedly exercising the UI would not be justified.

Fortunately, writing acceptance tests for REST APIs is not a difficult task. 

In this course, you will learn not only what a REST API is, and how REST APIs work, but you will also learn how to write high quality, expressive REST API tests using Rest Assured and Serenity BDD. You will see how RestAssured provides a clean, fluent API that makes reading and maintaining your REST API test code much easier. And you will learn how Serenity BDD integrates with RestAssured to provide powerful test reporting for REST API tests.

You will also learn how to write BDD executable specifications for REST APIs using Cucumber, and how this can provide rich living documentation for your web services, that can be used by teams using a web service to better understand what theaweb service does in business terms.

Course Curriculum

  • 1

    Welcome to the course!

    • What you will learn

    • Introduction

  • 2

    Your First REST API Test

    • What you will learn

    • Serenity REST Starter Project

    • Setting up your environment

    • The application domain - a real-time trading data platform

    • Writing your first REST API Test - reading the market price of a share

    • Test your learning

  • 3

    Testing GET REST API methods

    • Using Path and Query Parameters

    • Using JSONPath to get data from the response

    • Making assertions about the response

    • Getting headers and cookies from the response

  • 4

    Sending data with POST queries

    • A new demo application - BDD Trader

    • Posting JSON data to a REST end-point

    • Serialising and deserialising Java objects

  • 5

    Other request types: PUT and DELETE

    • Deleting resources with DELETE requests

    • Updating resources with PUT requests

  • 6

    Exercise

    • Implementing a scenario using POST and GET queries

  • 7

    Reporting REST API tests in Serenity

    • Refactoring the tests for better reporting

  • 8

    Testing REST APIs with Cucumber

    • Writing BDD scenarios for REST APIs

    • Cucumber and Rest Assured - Part 1

    • Cucumber and Rest Assured - Part 2

  • 9

    Modeling REST interactions with Serenity Screenplay

    • Your first REST API Screenplay test

    • Modelling REST end-points

    • Modelling REST requests

    • Making assertions with REST Questions

About the instructor

Author of BDD in Action

John Ferguson Smart

John is an international speaker, consultant, author and trainer well known in the Agile community for his many books, articles and presentations, particularly in areas such as BDD, TDD, test automation, software craftsmanship and team collaboration.John helps organisations and teams around the world deliver better software sooner through more effective collaboration and communication techniques, and through better technical practices.John is the author of the best-selling BDD in Action, as well as Jenkins: The Definitive Guide and Java Power Tools.Very active in the Open Source community, John also leads development on the innovative Serenity BDD test automation library, described as the "best opensource selenium webdriver framework".

What others have been saying about this course: