Skip to main content
DATA-OBSERVABILITY5 MIN READ

Write the Test That Returns Failures

Translate a business quality rule into a dbt-style data test that returns failing rows.

Refund sign handling can make revenue look positive or negative in the wrong direction. A data test is a query that returns rows disproving the assertion. The common trap is testing only row counts or job status because those checks are easy. They miss value-level failures that mislead users while the pipeline looks healthy. Rule Business assertion: net_payment_amount should not be negative for completed orders after refunds are applied according to policy. Write the rule in business language before SQL so the test protects a meaningful invariant. Failing rows Return order_id, customer_id, net_payment_amount, refund_amount, and payment_date where the assertion is…

Read the full lesson

Sign up free — one personalized lesson every day, matched to your role and goals.

Already have an account? Sign in

← Back to library
Contact us