sky-uk / csp-tech-radar

The Sky Plc Content Supply Platforms department technology radar.
Creative Commons Attribution Share Alike 4.0 International
6 stars 4 forks source link

Adopt "Consumer-driven contract testing" Technique #2

Closed pburls closed 6 years ago

pburls commented 6 years ago

A proposal for the Adoption of the "Consumer-driven contract testing" Technique to be used by teams when delivering services that consume external APIs. Markdown version of the reasoning below:

When two independently developed services are collaborating, changes to the supplier’s API can cause failures for all its consumers. Consuming services usually cannot test against live suppliers since such tests are slow and brittle or they are just not available yet, so it’s best to use Test Doubles (a.k.a. endpoint simulators), leading to the danger that the test doubles get out of sync with the real supplier service. Consumer teams can protect themselves from these failures by using integration contract tests (a.k.a. assumption tests) – tests that compare actual service responses with test values. While such contract tests are valuable, they are even more useful when consuming services provide these tests to the supplier, who can then run all their consumers’ contract tests to determine if their changes are likely to cause problems or a consumer's assumptions are incorrect – adopting consumer-driven contracts. Such consumer-driven contract tests are an essential part of a mature microservice testing portfolio.

emarques commented 6 years ago

Seems like a cool idea, for the suppliers to be aware of all the consumers of their APIs.

If I remember correctly, I was told that when I joined Sky that one of our teams from our department turned off an API that they thought nobody was using, and that ended up with a call from some other guys asking was wrong with it xD