
Explore contract testing with spring cloud contracts to tackle integration challenges in microservice architectures and coordinate http communication with other teams to boost production confidence.
Explore the testing pyramid, compare unit, integration, and end-to-end tests, discuss mock servers and their drawbacks, and introduce contract testing for microservices.
Explore contract testing as a better alternative to traditional integration testing in microservices, using shared contracts between consumer and producer and Spring Cloud Contract to validate via a mock server.
Learn contract testing with spring cloud contract by building a microservice project where microservice b returns video game recommendations via a rest api and integration tests illustrate the producer-consumer flow.
Build the producer side of contract testing for the video game recommendation service with Spring Cloud Contract, exposing a put endpoint that accepts user info and returns game recommendations.
Explore producer-side contract testing with spring cloud contract using Groovy DSL. Define a put request with JSON body (user id and genres) and a 200 response with video games.
Explore how Spring Cloud Contracts generate and verify producer side tests, configure Rest Assured mock mvc with a base test class, and ensure contracts align with generated contract verifier tests.
Implement the consumer side by sending user preferences to the recommendation service via a web client, tested with Spring Cloud Contract stub runner against a local mock producer.
Learn how Spring Cloud Contracts on the consumer side validate requests against contract definitions using a mock server, enabling fast failure on mismatched uids and precise responses.
Represent the contract DSL for query parameters by adding an optional exclusions parameter, filter out matching genres, and validate with Spring Cloud Contract using two prioritized mappings.
Explore dynamic properties in Spring Cloud Contract, enabling flexible test values via consumer and producer DSLs, including regex and uuid generation and optional properties.
Learn how optionals enable dynamic request parameters in contract testing with Spring Cloud Contract, including username fields that may be passed or omitted and verified in tests.
Enable dynamic property validation with custom methods in Spring Cloud Contract on the producer side, defining predefined genres and asserting them in unit tests through a base test class.
Explore dynamic properties and matchers, separating body validations from the request and the response, using jsonpath, by equality, by type, min/max occurrence, and custom methods.
Learn to reference request parts in the response using the front request method, including URL, query parameters, headers, and body, to dynamically populate an exclusions field.
Describe and name your contracts using description and name, use cookies and ignore options, reference external JSON bodies, and combine multiple contracts in one file for Spring Cloud Contract testing.
Explore using GitHub as a remote storage for Spring Cloud Contract stubs and contracts, with repository structure and plugin configuration for producer and consumer tests.
Complete this course on contract testing with spring cloud contract, enable controlled http testing across projects, and boost confidence in future production deployments.
Spring Cloud Contract is a powerful tool to do contract testing, if you have work with Pact, then you will quickly grasp Spring Cloud Contract. Using it you will be able to provide a lot of confidence to your team when making production releases and create solid integration tests avoiding any dependencies with other teams.
Before contract testing, devs had functional testing and mock servers as unique alternatives for integration test creation. This two have multiple advantages but even more disadvantages like:
Slow tests.
False positives.
Human error proneness.
Late feedback.
Dependencies with other teams.
Once contract testing got into the landscape, it was able to remedy all these issues by permitting the two sides of the communication to agree on how the request and responses should look like through a contract. Nonetheless, contract testing is not here to replace functional tests or unit tests but to support them.
For all these reasons this course will provide you with multiple lectures for you to learn:
Which strategies are used to test applications.
What contract testing is and how can improve the quality of any project you work on.
How contract testing is implemented by Spring Cloud Contract.
How to use Spring Cloud Contract to make integration tests for HTTP communications.
How to share your contracts with the members that are to suppose to integrate.
To be able to harness this course completely, it's strongly recommended to have knowledge of Java language, basic Spring Boot and unit testing with Mockito and JUnit.
If you're interested in doing contract testing but for message-based communications, I recommend taking my other course after completing this one: Contract Testing and Messaging with Spring Cloud Contract