From the course: Advanced Spring: Effective Integration Testing with Spring Boot

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Ensuring client app (rest call) and web app (controller) are in sync

Ensuring client app (rest call) and web app (controller) are in sync

From the course: Advanced Spring: Effective Integration Testing with Spring Boot

Start my 1-month free trial

Ensuring client app (rest call) and web app (controller) are in sync

- [Instructor] We have our service and client integration test on both end screen. But since they deviate in one or three bit name, they won't be able to work together. We want to make sure that any change on the service immediately impacts the client with a failing test. One way to get such assurance is by using Spring Cloud Contract. We will go ahead and define a contract in Groovy. In our students service application, under test, resources, contracts, we will create a new file, Should Return Student.groovy. This is the default directory where spring scans for all contracts. Don't be alarmed if you have not used Groovy before. Knowledge of the language is not really needed as DSL is statically typed to make it programmer readable without any knowledge of the DSL itself. Let's start by typing contract.make. First we add the description, should return a student. Then in the request, where we are going to define what a request will look like. We expect method of type get, and we'll…

Contents