Introduction to Spring Cloud Contract

Learn to develop and test Java microservices more effectively with this foundational course on Spring Cloud Contract, a Java-based consumer-driven contract framework.
Course info
Rating
(10)
Level
Beginner
Updated
May 14, 2018
Duration
3h 4m
Table of contents
Course Overview
Course Introduction
Microservices Testing Challenges and Spring Cloud Contract’s Motivation
What Is Consumer-driven Contract Testing?
HTTP Consumer-driven Contract Testing with Spring Cloud Contract
Advanced HTTP Consumer-driven Contract Testing with Spring Cloud Contract
Messaging Based Consumer-driven Contract Testing with Spring Cloud Contract
Description
Course info
Rating
(10)
Level
Beginner
Updated
May 14, 2018
Duration
3h 4m
Description

Testing Java microservices is challenging. This is because, despite their independence, they often end up being coupled through some form of message passing or API calls. In this course, Introduction to Spring Cloud Contract, you will learn foundational knowledge of a powerful new framework, gaining the ability to test and release Java microservices more effectively. First, you will learn about the challenges of microservices testing, taking a look at the shortcomings of both end-to-end testing microservices and mocking their collaborators. Next, you will discover the consumer-driven contracts testing technique, the TDD at the API level approach to microservices testing that Spring Cloud Contract implements. Finally, you will become proficient in using Spring Cloud Contract to build both HTTP driven and message driven Java microservices. When you're finished with this course, you will have the skills and knowledge of Spring Cloud Contract and consumer-driven contract testing needed to truly make your microservices independently testable and deployable.

About the author
About the author

Andrew is an independent consultant with cross-functional expertise in the design, development, and deployment of enterprise level software systems. Working with various clients, Andrew has been exposed to many different technology stacks, most recently specializing in Java microservices and continuous delivery.

More from the author
Introduction to WireMock
Intermediate
3h 36m
Mar 4, 2019
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone. I'm Andrew Morgan and welcome to my Pluralsight course Introduction to Spring Cloud Contract. I'm an independent consultant, trainer, and conference speaker, most recently specializing in both Java microservices and continuous delivery. Alright microservices architectures are becoming very popular, testing them can be hard and overcoming any challenges can be tough when using the more traditional testing strategies. This course will introduce you to Spring Cloud Contract, a consumer driven contract testing JVM based microservices framework. Some of the major topics that we'll cover include microservices testing challenges and the shortcomings of traditional testing approaches, how we can use a consumer-driven contract testing technique to test microservices more effectively, and finally building and testing both HTTP driven and message driven Java microservices with Spring Cloud Contract and consumer driven contract testing. By the end of the course, you'll know the basics of Spring Cloud Contract and consumer driven contract testing and you'll be able to use it to develop and test your own Java microservices. Before beginning the course, you should know Java and it would also be beneficial to have some knowledge of microservices and Spring Boot. I hope you'll join me on this journey to learn how to more effectively test Java microservices with the Introduction to Spring Cloud Contract course at Pluralsight.

Microservices Testing Challenges and Spring Cloud Contract’s Motivation
In this module, we'll be learning about the challenges of testing microservices in order to help us understand the motivation for Spring Cloud Contract. We'll first give a quick overview of microservices and their benefits in order to fill any knowledge gaps that we might have in this space. It's important to do this as Spring Cloud Contract is aimed at microservices architectures. We'll then going to look at some of the testing challenges that microservices architectures introduce. We'll take a look at using the traditional approach of end-to-end testing to work around these sorts of challenges, and we'll see what sorts of shortcomings this approach has. As an alternative, we'll look at how we can test microservices independently by mocking or stubbing the microservices that they depend on. We'll also analyze the shortcomings of this strategy. We'll also talk about the software development feedback loop, seeing where the testing strategies we talked about so far fit in, and highlight how these can be problematic. And finally we'll achieve the main goal of this module, which is to really understand the sorts of problems that are the motivation for Spring Cloud Contract.

What Is Consumer-driven Contract Testing?
Hi, my name is Andrew Morgan and welcome to the course Introduction to Spring Cloud Contract. In this module we're going to be looking at testing technique called consumer-driven contract testing. This will be the technique we'll be adopting through the rest of the course, as it's a technique implemented by Spring Cloud Contract itself. We're going to start by giving a high level overview of consumer-driven contract testing, explaining what it's all about. We're then going to explain what a contract is, as it is a core entity that consumer-driven contract testing is build around. We'll then follow through to consumer-driven contract testing workflow end-to-end, explaining each stage as we go along. And finally, we'll recap some of the benefits of the technique, explaining the advantages of adopting it, in addition to more traditional testing strategies.

HTTP Consumer-driven Contract Testing with Spring Cloud Contract
Hi, my name is Andrew Morgan, and welcome to the course Introduction to Spring Cloud Contract. In this module we're going to take a hands on approach to consumer driven contract testing with a goal of being able to use Spring Cloud Contract to build HTTP based Java microservices. First we'll introduce Spring Cloud Contract, explaining its core functionality and how it can be used to achieve the consumer-driven contract testing technique. We'll then use it to implement to an HTTP Spring Boot microservices, following through to consumer-driven contracts testing workflow end-to-end. This will include learning how to define contracts using a contract definition language. We'll learn how to generate stubs and contract verification tests using the Spring Cloud Contract Verifier, and finally we'll learn how to execute stubs on the consumer side by using the Stub Runner.

Advanced HTTP Consumer-driven Contract Testing with Spring Cloud Contract
Hi, I'm Andrew Morgan, and welcome to the course Introduction to Spring Cloud Contract. In this module we'll be building on what we've learned so far by introducing some more advanced consumer-driven contract testing principles. First of all, we're going to take a look at how we can support multiple contracts between a consumer and the provider, as currently we have only supported a single interaction. We'll also look at how a contract can support multiple requests via regular expressions, which is particularly useful when we account for dynamic data, such as UUIDs or timestamps. Then we'll learn about how we can have more granular control over both the consumer and provider side of our interaction by leveraging the consumer and producer methods. And finally, we'll learn about the shared repository pattern, a means of centralizing all of our contracts together into a single repository.

Messaging Based Consumer-driven Contract Testing with Spring Cloud Contract
Hi, I'm Andrew Morgan, and welcome to the final module of the course Introduction to Spring Cloud Contract. In this module, we'll be expanding on what we've already learned by building message driven rather than HTTP driven microservices. First of all, we're going to give a high level overview of why message-driven microservices still benefit from, if not require, consumer-driven contract testing. After explaining this motivation, we'll then introduce how Spring Cloud Contract functions with messaging. This will include using it to verify we can see messages correctly, that we produce messages correctly, and that we are able to implement the input-output pattern, why the consumption of one message can cause another to be produced.