ARTICLE AD BOX
Background
Currently, we have implemented a provider driven contract test using Spring Cloud Contract. We have multiple contracts for each of provider’s endpoints being used by the consumer. Then the contract verifier runs on provider side and tests that actual endpoint structure matches that of the specified contract. Then the stub jar that’s built gets published to the artifactory for the consumer to use. On the consumer side, it has its own tests that runs against the wire mock created by the producer’s stub jars. So this is our current structure, follows the very practice of provider driven contract test.
Issue
The issue is that our consumer is the ONLY CONSUMER of the provider so we want the provider to accommodate for the calls that the consumer is making. This is because whenever there is change in consumer (Say we no longer need a specific field from producer), producer won’t see the change that was made in the consumer.
(It’s kind of a one way direction where changes in the producer gets reflected in consumer, but not the other way around.)
So basically we want the producer to fail when it doesn’t match the expectation of the consumer? (We don’t want the consumer to fail because the changes were made in producer, rather we want the producer to fail when calls from consumer is changed)
TLDR: Can this be done with contract testing?
I’ve looked into this for few days, but it seems like the traditional practices of Spring Cloud Contract follows that of provider driven even though it states that SCC is natively CDC (Consumer Driven Contract)?
Spring Cloud Contract Verifier is a tool that enables Consumer Driven Contract (CDC) development of JVM-based applications.
https://spring.io/projects/spring-cloud-contract#overview
There are already few StackOverflow discussions that questions it, but doesn’t give clear answer on whether it is PDC or CDC.
Spring Cloud Contract - is it Consumer Driven?
https://stackoverflow.com/questions/53918001/when-using-spring-cloud-contracts-why-is-the-producer-…
And even those most real-world examples, tutorials, highlights it being CDC, but the actually demos showcase provider-driven usage. For example this video that describes CDC, but still implements it in a very provider-driven way: https://www.youtube.com/watch?v=qMXsTb_rPpA
