Creating and testing REST contracts with Accurest Gradle Plugin
REST does not come with an in-built contract compliance mechanism, which in many ways is a great thing (no cumbersome xml schemas). However, while working with microservice-based systems, it often appears that a practical mechanism that would provide help in shaping and describing REST contracts would come in handy.
Similarly, creating integration and acceptance tests in such systems presents many challenges. On one hand, we want to make the development and deployment of each service independent and agile, so we tend to use stubs, on the other hand, if we are not able to carry out proper E2E tests, we want to make sure that at any point in time, our stubs are in keeping with how are server actually responds to any given request.
In this talk, I will present Accurest, a Gradle plugin that allows for both: easily shaping REST contracts and verifying if our app adheres to them using automatically generated Spock tests. I will show how, using Accurest, we can quickly generate automatically-tested stubs from simple Groovy DSL scripts. I will talk about the typical usages and script examples, as well as possible problems and ways of handling them.
Olga Maciaszek-Sharma is a Java and Groovy Developer at Codearte. She has gained her experience while working with microservices where cutting-edge solutions were used as well as with complex legacy systems, implementing both new business features and solutions aimed at improving the process of continuous deployment and setup of applications. Olga is also a contributor of the OSS projects: Accurest, JFairy, Jenkins Stash Pull Request Builder Plugin and a few others.
Before switching to development, she worked for more than 3 years as Quality Assurance Engineer, specialized in test automation.