What is contract testing and when does it beat integration tests?
AdvancedConceptTesting and Quality Gates
Answer
Contract testing (Pact, Spring Cloud Contract) verifies that a service consumer and provider agree on the API shape without deploying both. The consumer test generates a contract; the provider pipeline verifies it can satisfy all consumer contracts, and a broker tracks compatibility (can-i-deploy). It beats full integration environments in microservice estates because tests are fast, deterministic and run in each service's own pipeline.
pact-broker can-i-deploy --pacticipant orders --version $GIT_SHA --to-environment production
More on Testing and Quality Gates
What is the testing pyramid?BeginnerWhat is the difference between unit, integration, and end-to-end tests?BeginnerWhat are smoke tests and sanity tests in a deployment pipeline?IntermediateWhat is code coverage and is a high percentage a good target?IntermediateWhat is a quality gate in SonarQube?IntermediateHow do you integrate SonarQube into a CI pipeline and make it block on gate failure?Intermediate