Tuesday, November 23, 2021

Contract Testing

 Contract testing is a methodology for ensuring that two separate systems (such as two microservices) are  compatible and are able to communicate with one other.

 It captures the interactions that are exchanged between each service, storing them in a contract, which can then be used to verify that both parties adhere to it.

Contract testing goes beyond schema testing, requiring both parties to come to a consensus on the allowed set of interactions and allowing for evolution over time.

Pact is a code-first consumer-driven contract testing tool, and is generally used by developers and testers who code. The contract is generated during the execution of the automated consumer tests.

A major advantage of this pattern is that only parts of the communication that are actually used by the consumer(s) get tested. 

This in turn means that any provider behaviour not used by current consumers is free to change without breaking tests.

ES12 new Features