Testing REST APIs with Cucumber, Rest Assured and Serenity BDD – a tutorial

John Ferguson Smart | Mentor | Author | Speaker - Author of 'BDD in Action'.
Helping teams deliver more valuable software sooner12th June 2018

Nowadays, applications rely more and more on well designed, well documented and well tested APIs, and the number of these APIs is steadily increasing. Simply writing test scripts for our REST end points is no longer enough - our APIs need not just tests, but living documentation.

The Screenplay pattern is a powerful way of writing highly reusable, and highly maintainable, automated acceptance tests that also act as living documentation. Screenplay also excels at building test components that you can easily use elsewhere in other tests, saving time in both test writing and test execution.

In this tutorial, you can learn how to write automated acceptance criteria and living documentation for your REST APIs using the powerful combination of Cucumber, Rest-Assured, and Serenity BDD with the Screenplay pattern. Rather than using overly simplified examples, this tutorial aims to give you a more realistic experience. Instead of starting from scratch, you start with a working application and some existing tests, as you might do on a real project. You can use these tests to see how to, and then try it out with some exercises.

Want to try it out? First, learn how the application works here: https://github.com/serenity-bdd/bdd-trader. Then try out the exercises here: https://github.com/serenity-bdd/bdd-trader/blob/master/exercises.adoc.

© 2019 John Ferguson Smart