Video in progress

Staff 🧪 Testing

In an organization with 15 teams and 60 services, how do you standardize the test strategy without choking the teams' independence?

I set a small "minimum" that's mandatory for everyone (contract tests, integration tests against a real database, a time limit in CI, a flaky policy), and recommend the rest through templates, a shared library and metrics. The rules are about outcomes, not about a specific tool.

📖 Answer

Both extremes work badly. "Every team knows best": after a year there are three mocking libraries, five kinds of test database, and nobody can read another team's tests. "A central QA policy": a 40-page document nobody reads, which teams work around.

The mandatory minimum I set (short and checkable):

  • a contract test for each external API of a service and each of its consumers, with can-i-deploy through the broker;
  • the persistence layer is tested against a real database engine (not H2);
  • the test stage in the PR pipeline doesn't exceed 10 minutes; if it does, a ticket is created automatically in the team's backlog;
  • a flaky test quarantine policy and an owner;
  • every production incident's postmortem has a "which test should have caught this" item.

Recommended things (the golden path):

  • a service template (template repo) with Testcontainers configuration, test data builders, Awaitility and ArchUnit rules ready to go;
  • an internal test library: an auth token generator, shared fakes, Kafka test helpers;
  • 2-3 well-tested services as "examples".

How I check: a per-service dashboard with CI time, flaky count, change failure rate, and incidents caused by regressions. I show coverage here only as context.

A team may deviate from a mandatory rule, but with a written ADR and the reason. For example, for an ML inference service, contract tests look different. Without that "way out", rules get quietly circumvented.

The template usually has the biggest effect: if a new service is born with the right settings, nothing has to be fixed later.