Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. Testing pipelines vs testing data

Data quality · Building Quality In

Testing pipelines vs testing data

Mediumdata-quality-28
unit-testingdata-testingtesting-strategyci-cd

Question

What's the difference between testing pipeline code and testing data?

Solution

Testing pipeline code verifies that data transformation logic functions correctly using deterministic inputs before software is deployed. Testing data evaluates live production records on every pipeline execution to confirm that incoming values conform to schema, volume, and business integrity rules.

Code assertions versus dynamic data checks

Software testing and data testing address different points of vulnerability in a data platform:

  • Unit tests for pipeline code: Run in CI/CD pipelines against mocked inputs. They verify that business calculation functions, regular expressions, and SQL macros produce expected outputs across boundary conditions without touching production databases.
  • Integration tests: Execute end-to-end pipeline DAGs against staging containers or temporary schemas using synthetic datasets. They confirm that orchestrators, storage credentials, network drivers, and cross-task dependencies function as intended.
  • Data tests: Run continuously in production on real datasets during or immediately after batch loads. They check live realities such as primary key uniqueness, null counts, foreign key integrity, and volume baselines.
Pipeline Code Tests (Pre-Deploy) -> Unit tests with mocks, CI/CD integration suites
Production Data Tests (Post-Run) -> Freshness checks, uniqueness tests, volume anomalies

Production pipelines require both testing strategies because data breaks without any code changes:

  • An upstream microservice can alter an unversioned JSON payload, introducing null values into mandatory columns.
  • Operational database migrations can drop constraints or emit duplicate records without notifying data teams.
  • Transformation code with complete unit test coverage cannot prevent corrupted input data from generating faulty analytical metrics.

Building dependable testing suites

A reliable data platform combines automated CI/CD gating for transformation code with runtime assertion suites for incoming data. This dual-layer approach catches logic bugs before deployment and catches data anomalies before dashboards refresh.

PreviousNext