Member-only story

When Is The Inverted Contract Testing Really Necessary?

The when and the how of protecting your software against external changes.

David Rodenas PhD

Two software developers working on the ceiling upside down. One says “I do not understand why they say inverted”. The other is scratching his head, trying to imagine software developers working on the floor.
“Developers working on the floor?” — Prompted and edited by the author.

In my previous article, I discussed the inverted contract testing, which involves testing in a manner contrary to what we usually expect. Normally, contract testing implies that the service creates its own definitions and tests. However, we can go a step further and have the client create tests for the service. But when to do that?

The why is straightforward.

If we are developing a client, and we have no control over the service, we’re at risk. Even if we don’t change anything on our end, changes in the service can still break our application.

How do we prevent this?

As the previous article says, by adding the client’s relevant tests into the service’s own code repository. That safeguards ourselves from breaking changes. Any dangerous change by the service will break its own CI, forcing a dialogue and agreement on a solution with us. We are protected.

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

David Rodenas PhD
David Rodenas PhD

Written by David Rodenas PhD

Passionate software engineer & storyteller. Sharing knowledge to advance our skills. Join me on a journey of discovery in the world of software engineering.

Responses (2)

Write a response

Amazing article!
I think that I've been applying this technique some time ago on my last REST API developments.
In my last projects it has been always one BFF part of the API to serve as backend for our own frontend apps, so, we had to make sure that…