FR EN
Data Quality: Testing and Validation
Data Quality: Testing and Validation — AutomationDataCamp
April 25, 2026 · Updated September 29, 2026 8 min read

Data Quality: Testing and Validation

Data quality testing checks that data is complete, accurate, consistent, unique, valid and fresh before anyone relies on it.

In practice, you write automated assertions on your data sets, such as "this column is never null", "this ID is unique" or "yesterday's load has arrived", and run them at each stage of the pipeline with tools such as Great Expectations, dbt tests or Soda. This guide explains the dimensions of data quality, which checks to write at each layer and how the main tools compare.

Key takeaways
  • Six dimensions cover most needs: completeness, accuracy, consistency, uniqueness, validity and freshness
  • Data changes even when code does not: data checks must run on every load, not only on every commit
  • Great Expectations (Python), dbt data tests (SQL, in the transformation project) and Soda (YAML checks on warehouses) are the most common open-source options
  • Start small: keys not null and unique, row counts, freshness and accepted values on your most critical tables

What is data quality testing?

Data quality testing is the automated verification that a data set meets explicit expectations about its content, structure and timeliness. Each expectation is a rule that can pass or fail, such as "order_id is unique" or "amount is greater than zero", and a failure stops the pipeline or alerts the data owner before the data reaches a dashboard, a report or a machine learning model.

What are the dimensions of data quality?

The most commonly used dimensions are completeness, accuracy, consistency, uniqueness, validity and freshness (also called timeliness). Each one translates into concrete, automatable checks.

DimensionQuestion it answersExample check
CompletenessIs anything missing?No null in required columns; expected number of rows
AccuracyDoes the value match reality?Totals reconcile with the source system
ConsistencyDo systems agree?Same customer status in the CRM and the warehouse
UniquenessAre there duplicates?Primary keys are unique
ValidityDoes the value respect the rules?Format, range and allowed values (for example, a valid country code)
FreshnessIs it up to date?Latest record loaded within the agreed delay

How is data quality testing different from software testing?

Software tests verify code against fixed inputs; data quality tests verify data that changes every day, even when no code has changed. A transformation can be correct and still produce wrong results because an upstream system sent an empty file or a new category. You need both: unit tests on the transformation logic, run in CI on each commit, and data checks run on every load in production. Our guide to integrating tests into CI/CD covers the first part.

Which checks should you run at each stage of a data pipeline?

Validate early and at every hand-off, so a problem is caught where it enters rather than in the final report.

  1. Ingestion: check the schema and types as data arrives, with data contracts expressed in JSON Schema, Avro or Pydantic models; reject or quarantine invalid records.
  2. Transformation: test the outputs of dbt or Spark jobs for keys, relationships and business rules.
  3. Loading: reconcile row counts and totals between source and target, and check for duplicates introduced by re-runs.
  4. Consumption: monitor freshness and the key metrics used by dashboards, and alert when they move outside expected bounds.

What is Great Expectations?

Great Expectations is an open-source Python framework for validating data. You declare "Expectations" such as expect_column_values_to_not_be_null or expect_column_values_to_be_between, group them into suites and validate batches of data from files, dataframes or SQL databases. Validation results can be rendered as human-readable "Data Docs". It suits Python-based pipelines and teams that want data checks written in code.

How do dbt tests work?

In dbt, data tests are queries that return the rows violating a rule: if the query returns no rows, the test passes. Four generic tests are built in, unique, not_null, accepted_values and relationships, and are declared in YAML next to the model. Singular tests are custom SQL files for business rules. dbt test runs them, and dbt build runs models and tests in dependency order, so a failing test stops downstream models from building.

What is Soda?

Soda is a data quality tool whose open-source engine, Soda Core, runs checks written in SodaCL, a YAML-based language, against data sources such as PostgreSQL, Snowflake or BigQuery. Checks like row_count > 0, missing_count(email) = 0 or freshness thresholds are readable by analysts as well as engineers, which makes Soda a good fit when business teams help define the rules.

Great Expectations vs dbt tests vs Soda: which should you choose?

If your transformations already live in dbt, start with dbt data tests; add Great Expectations for Python pipelines and richer statistical checks, or Soda for readable checks on warehouses shared with business teams.

ToolChecks written inRuns onBest for
Great ExpectationsPythonFiles, dataframes, SQL databasesPython pipelines, detailed validation reports
dbt data testsYAML and SQLThe warehouse used by the dbt projectTeams already transforming data with dbt
Soda CoreSodaCL (YAML)Warehouses and databasesReadable checks shared with business teams

Which data quality metrics should you monitor?

Monitor a few metrics on the tables that matter most to the business, rather than everything everywhere: null rate on required fields, duplicate rate on keys, row count compared with the expected volume, time since the last successful load, and the distribution of key numeric values.

Sudden shifts in a distribution often reveal a broken upstream source before any rule fails; statistical and machine learning methods for detecting such anomalies are covered in our article on AI and machine learning for testing.

How do you get started with data quality testing?

Pick your most critical tables and add five checks to each: keys not null, keys unique, row count above a minimum, freshness within the agreed delay, and accepted values on the main status columns. Run them after every load, send failures to the table's owner, and add a new check each time an incident reveals a gap. Reusing test data techniques from software testing helps too; see our data-driven testing guide.

Frequently asked questions

What are the six dimensions of data quality?

Completeness, accuracy, consistency, uniqueness, validity and freshness (or timeliness). Each one can be turned into automated checks, such as no null in required columns or primary keys that are unique.

What is the difference between data validation and data testing?

The terms overlap. Data validation usually means checking incoming data against rules before it is used, while data testing also covers checking the output of transformations. Both rely on automated assertions on the data.

Is Great Expectations better than dbt tests?

Neither is better in general. dbt tests are the simplest choice when transformations are already in dbt; Great Expectations suits Python pipelines and offers a larger library of built-in expectations. Many teams use both.

How often should data quality checks run?

On every data load or pipeline run, because data can change without any code change. Tests of the transformation code itself should also run in CI on every commit.

Do QA testers need data quality skills?

Increasingly, yes. Applications, analytics and AI features all depend on data, so testers who can write SQL checks and validate pipelines can cover risks that UI and API tests miss.

Learn to test data with Python

At AutomationDataCamp (ADC), the Data-Driven Testing with Python course (50 h, online) covers CSV, Excel and JSON data management and database integration in automated tests, the foundations for validating data in pipelines.

View the DDT course View all courses

Related articles