0

Got a requirement saying that downstream no longer wants to receive a certain attribute in our response. We're not following Semantic Versioning contracts (another story).

Given this is removal of an attribute, should I write a (unit) test to assert it's no longer being returned?

Some on my team make the (interesting) objection:

it adds complexity to the code to mention things that don't exist.

Tried showing the Acceptance Criteria were met.

noodnik2
  • 1
  • 2
  • You should have a test to verify your response schema is as per what your downstream is expecting. However unit tests are not suitable for this purpose. You may want to consider adopting API specifications such as OpenAPI (https://www.openapis.org/) to capture your API signature and then leverage that specification as a test with tools such as Dredd (https://dredd.org/en/latest/), Specmatic (https://specmatic.in/#contract-as-test). This specification can also be an unambiguous way to communicate your API signature with to downstream. Hope this helps. – HariKrishnan Feb 03 '23 at 05:14

0 Answers0