Advertisement /206696744/dsx/crmroute_top_over_banner · 970×90
CRM Route
Advertisement /206696744/dsx/crmroute_top_below_banner · 728×90

Test Your Data Like You Test Your Code

A silent data bug is worse than a failed job. The pipeline ran, the dashboard is green, and the numbers have been wrong since Tuesday.

Test Your Data Like You Test Your Code

Software engineering learned decades ago not to ship without tests. Data pipelines are frequently held to a lower standard: they are monitored for whether the job completed, not for whether the output is correct. The result is the characteristic data failure — everything green, numbers wrong, discovered by a business user three weeks later.

The four tests to start with

Most real data incidents would have been caught by a small, unglamorous set of assertions.

• Uniqueness — the primary key is actually unique. Duplicated joins are the most common cause of inflated metrics.

• Not-null — required fields are populated, especially foreign keys and dates.

• Referential integrity — every foreign key resolves. Orphans silently drop rows from joins.

• Accepted values — status and category fields contain only known members.

Then add the ones that catch silent drift

The four above check individual rows. The dangerous failures are structural, where every row is valid and the set is wrong.

• Volume anomaly — today's row count within a sensible band of the recent average.

• Freshness — the newest record is recent enough to be plausible.

• Reconciliation — key aggregates match the source system, to the penny for financials.

Advertisement /206696744/dsx/crmroute_scroll_in_articles · 300×250

• Distribution — the share of rows per category hasn't shifted abruptly.

Every row can be individually valid while the table as a whole is badly wrong. Test the set, not just the rows.

Warn and fail are different

If every test blocks the pipeline, the pipeline stops nightly for known cosmetic issues and people learn to override it. Classify deliberately: anything that would produce a wrong published number should fail and stop; anything indicative should warn and be reviewed. Review the warnings weekly or they become a log nobody reads.

Test at the boundary

Put assertions where data enters your control — immediately after ingestion — as well as on the final models. A test at the end tells you something is wrong; a test at the boundary tells you which upstream system changed, which is most of the diagnosis.

Alert to a person, with the query attached

A failure that pages a rota and includes the failing rows gets fixed. A failure that emails a shared mailbox does not. Give every test an owner and make the alert contain enough context to start work — the assertion, the actual value, and a query that reproduces it.

Write the test when the incident happens

The most efficient way to build a useful suite is to add one assertion for every data incident you actually suffer, at the point of fixing it. Within a year the suite reflects your real failure modes rather than a generic checklist, and it does so without anyone having to plan a data quality programme.

Discussion (3)

You
NK
Nadine K. Aug 10, 2026

Volume-anomaly tests caught the bug that uniqueness and not-null never would have: an upstream filter change halved our order rows and every individual row was perfectly valid.

BA
Bruno A. Aug 14, 2026

Splitting tests into warn and fail is what made ours sustainable. Everything blocking meant the pipeline stopped nightly for known-benign issues, and people started ignoring the alerts.

PS
Priti S. Aug 19, 2026

The reconciliation-to-source test is the one that buys credibility with finance. If our revenue total matches the ledger to the penny every morning, nobody argues about the rest of the model.

Ready for more?

Subscribe