Spring Cloud Contract


Table of Contents

1. Spring Cloud Contract
2. Spring Cloud Contract Verifier Introduction
2.1. Why?
2.1.1. Testing issues
2.2. Purposes
2.3. How
2.3.1. Define the contract
2.3.2. Client Side
2.3.3. Server Side
2.4. Step by step guide to CDC
2.4.1. Technical note
2.4.2. Consumer side (Loan Issuance)
2.4.3. Producer side (Fraud Detection server)
2.4.4. Consumer side (Loan Issuance) final step
2.5. Dependencies
2.6. Additional links
2.6.1. Spring Cloud Contract video
2.6.2. Readings
2.7. Samples
3. Spring Cloud Contract Verifier Setup
3.1. Gradle Project
3.1.1. Prerequisites
3.1.2. Add gradle plugin with dependencies
3.1.3. Gradle and Rest Assured 3.0
3.1.4. Snapshot versions for Gradle
3.1.5. Add stubs
3.1.6. Run plugin
3.1.7. Default setup
3.1.8. Configure plugin
3.1.9. Configuration options
3.1.10. Single base class for all tests
3.1.11. Different base classes for contracts
3.1.12. Invoking generated tests
3.1.13. Spring Cloud Contract Verifier on consumer side
3.2. Using in your Maven project
3.2.1. Add maven plugin
3.2.2. Maven and Rest Assured 3.0
3.2.3. Snapshot versions for Maven
3.2.4. Add stubs
3.2.5. Run plugin
3.2.6. Configure plugin
3.2.7. Important configuration options
3.2.8. Single base class for all tests
3.2.9. Different base classes for contracts
3.2.10. Invoking generated tests
3.2.11. FAQ with Maven Plugin
3.2.12. Maven Plugin and STS
3.2.13. Spring Cloud Contract Verifier on consumer side
3.3. Scenarios
3.4. Stubs and transitive dependencies
4. Spring Cloud Contract Verifier Messaging
4.1. Integrations
4.2. Manual Integration Testing
4.3. Publisher side test generation
4.3.1. Scenario 1 (no input message)
4.3.2. Scenario 2 (output triggered by input)
4.3.3. Scenario 3 (no output message)
4.4. Consumer Stub Side generation
5. Spring Cloud Contract Stub Runner
5.1. Snapshot versions
5.2. Publishing stubs as JARs
5.3. Stub Runner Core
5.3.1. Retrieving stubs
Stub downloading
Classpath scanning
5.3.2. Running stubs
Limitations
Running using main app
HTTP Stubs
Viewing registered mappings
Messaging Stubs
5.4. Stub Runner JUnit Rule
5.4.1. Maven settings
5.4.2. Providing fixed ports
5.4.3. Fluent API
5.4.4. Stub Runner with Spring
5.5. Stub Runner Spring Cloud
5.5.1. Stubbing Service Discovery
Test profiles and service discovery
5.5.2. Additional Configuration
5.6. Stub Runner Boot Application
5.6.1. How to use it?
Stub Runner Server
Spring Cloud CLI
5.6.2. Endpoints
HTTP
Messaging
5.6.3. Example
5.6.4. Stub Runner Boot with Service Discovery
5.7. Stubs Per Consumer
5.8. Common
5.8.1. Common properties for JUnit and Spring
5.8.2. Stub runner stubs ids
6. Stub Runner for Messaging
6.1. Stub triggering
6.1.1. Trigger by label
6.1.2. Trigger by group and artifact ids
6.1.3. Trigger by artifact ids
6.1.4. Trigger all messages
6.2. Stub Runner Camel
6.2.1. Adding it to the project
6.2.2. Disabling the functionality
6.2.3. Examples
Stubs structure
Scenario 1 (no input message)
Scenario 2 (output triggered by input)
Scenario 3 (input with no output)
6.3. Stub Runner Integration
6.3.1. Adding it to the project
6.3.2. Disabling the functionality
6.3.3. Examples
Stubs structure
Scenario 1 (no input message)
Scenario 2 (output triggered by input)
Scenario 3 (input with no output)
6.4. Stub Runner Stream
6.4.1. Adding it to the project
6.4.2. Disabling the functionality
6.4.3. Examples
Stubs structure
Scenario 1 (no input message)
Scenario 2 (output triggered by input)
Scenario 3 (input with no output)
6.5. Stub Runner Spring AMQP
6.5.1. Adding it to the project
6.5.2. Examples
Stubs structure
Triggering the message
Spring AMQP Test Configuration
7. Contract DSL
7.1. Limitations
7.2. Common Top-Level elements
7.2.1. Description
7.2.2. Name
7.2.3. Ignoring Contracts
7.2.4. HTTP Top-Level Elements
7.3. Request
7.4. Response
7.5. Dynamic properties
7.5.1. Dynamic properties inside the body
7.5.2. Regular expressions
7.5.3. Passing Optional Parameters
7.5.4. Executing Custom Methods on the Server Side
7.5.5. Referencing the Request from the Response
7.5.6. Registering Your Own WireMock Extension
7.5.7. Dynamic Properties in the Matchers Sections
7.6. JAX-RS Support
7.7. Async Support
7.8. Working with Context Paths
7.9. Messaging Top-Level Elements
7.9.1. Output Triggered by a Method
7.9.2. Output Triggered by a Message
7.9.3. Consumer/Producer
7.9.4. Common
7.10. Multiple Contracts in One File
8. Customization
8.1. Extending the DSL
8.1.1. Common JAR
8.1.2. Adding the Dependency to the Project
8.1.3. Test the Dependency in the Project’s Dependencies
8.1.4. Test a Dependency in the Plugin’s Dependencies
8.1.5. Referencing classes in DSLs
9. Using the Pluggable Architecture
9.1. Custom Contract Converter
9.1.1. Pact Converter
9.1.2. Pact Contract
9.1.3. Pact for Producers
9.1.4. Pact for Consumers
9.2. Using the Custom Test Generator
9.3. Using the Custom Stub Generator
9.4. Using the Custom Stub Runner
9.5. Using the Custom Stub Downloader
10. Spring Cloud Contract WireMock
10.1. Registering Stubs Automatically
10.2. Using Files to Specify the Stub Bodies
10.3. Alternative: Using JUnit Rules
10.4. Relaxed SSL Validation for Rest Template
10.5. WireMock and Spring MVC Mocks
10.6. Generating Stubs using RestDocs
10.7. Generating Contracts using RestDocs
11. Links