Get ahead
VMware offers training and certification to turbo-charge your progress.
Learn moreOn behalf of the team, I am happy to announce the general availability of the Spring Cloud Contract in version 1.0.0.RELEASE. You can download it from Spring Release or Maven Central. The reference documentation is available here. The release notes are available here.
What is Spring Cloud Contract for? What you always need is confidence in pushing new features into a new application or service in a distributed system. Spring Cloud Contract project provides support for Consumer Driven Contracts and service schemas in Spring applications, covering a range of options for writing tests, publishing them as assets, asserting that a contract is kept by producers and consumers, for HTTP and message-based interactions.
Spring Cloud Contract consists of three main projects:
At a high level:
It's a tool that enables Consumer Driven Contract (CDC) development of JVM-based applications. It is shipped with Contract Definition Language (DSL). Contract definitions are used to produce following resources:
Spring Cloud Contract Verifier moves TDD to the level of software architecture.
Gives you the possibility to use WireMock with different servers by using the "ambient" server embedded in a Spring Boot application. Check out the samples for more details.
If you have a Spring Boot application that uses Tomcat as an embedded server, for example (the default with spring-boot-starter-web), then you can simply add spring-cloud-contract-wiremock to your classpath and add @AutoConfigureWireMock
in order to be able to use Wiremock in your tests. Wiremock runs as a stub server and you can register stub behaviour using a Java API or via static JSON declarations as part of your test
Spring RestDocs can be used to generate documentation (e.g. in asciidoctor format) for an HTTP API with Spring MockMvc or RestEasy. At the same time as you generate documentation for your API, you can also generate WireMock stubs, by using Spring Cloud Contract WireMock. Just write your normal RestDocs test cases and use @AutoConfigureRestDocs
to have stubs automatically in the restdocs output directory
As always, you can stay in touch with us either in GitHub, on Stack Overflow, on Gitter, or on Twitter.