Skip to main content
Beginner Guide · SQL · Data Testing

ETL Testing Tutorial for Beginners: How to Test Data, Step by Step

Learn what ETL is, the 8 checks every ETL tester runs, and the exact SQL queries to run them. Then see a real example and how to automate the checks with Java. No experience needed beyond basic SQL.

✍️ Written by Shivam Singh•Founder & QA Engineer•Updated: November 2026

What Is ETL?

ETL stands for Extract, Transform, Load. It is the process companies use to move data from the systems where it is created (an online shop, a bank's core system, a hospital app) into one central place where it is used for reports and decisions. That central place is usually called a data warehouse.

Think of a juice factory. Fruit arrives from many farms (Extract). The factory washes it, removes bad fruit and makes juice (Transform). Then the juice is bottled and sent to shops (Load). If the factory loses fruit, mixes up flavours or fills bottles halfway, customers get the wrong product. ETL testing is the quality check at every stage of that factory.

Extract

Read data from the source systems: databases, CSV files, APIs or Excel sheets.

Transform

Clean and change the data: fix formats, remove duplicates, calculate totals, convert currencies, join tables.

Load

Write the final data into the target, usually a data warehouse such as Snowflake, Redshift or BigQuery.

What Is ETL Testing?

ETL testing means proving that the data in the target is complete, correct and trustworthy. Managers make real decisions from warehouse reports: how much stock to buy, which loans to approve, how many nurses a ward needs. If the data is wrong, the decision is wrong, even though no screen ever showed an error.

That is what makes ETL bugs dangerous: they are silent. A web page that crashes gets noticed in minutes. A sales report that is 3% too low can go unnoticed for months. ETL testers catch these problems before anyone relies on the numbers.

An ETL tester answers four questions

  1. Did all the data arrive? (nothing lost)
  2. Did only the right data arrive? (nothing extra, no duplicates)
  3. Was every value changed exactly as the business rules say?
  4. Is the data clean? (no blanks, bad formats or broken links between tables)

ETL Testing vs Database Testing

Both use SQL, so beginners often mix them up. The difference is what you are checking.

PointDatabase testingETL testing
Main questionDoes the app save and read data correctly?Did data move from source to target correctly?
WhereOne application databaseSource systems and a data warehouse
Data sizeUsually small, per transactionOften millions of rows per load
Typical checksConstraints, stored procedures, triggers, CRUDRow counts, transformations, duplicates, history
Who uses the resultApp usersAnalysts, managers, reports, AI models

If you are new to database testing, start with the free database testing process lesson. ETL testing builds on the same SQL skills.

The ETL Testing Process (7 Steps)

Most teams follow these steps for every new ETL job or change.

  1. 1

    Understand the requirements

    Read the mapping document. It lists every target column, where it comes from and the rule that changes it, such as "total_amount = quantity × unit_price, rounded to 2 decimals".

  2. 2

    Study the source data

    Look at real source rows. Find NULLs, odd formats and duplicates before the ETL runs, so you know what the job must handle.

  3. 3

    Write test cases

    One test case per rule: counts, each transformation, each data quality rule. Write the SQL query and the expected result for each one.

  4. 4

    Prepare test data

    Add rows that test the edges: a NULL email, a negative amount, a name with an apostrophe, a date on 29 February.

  5. 5

    Run the ETL job

    Run the load in the test environment and note the start and end time and the number of rows processed.

  6. 6

    Run your checks

    Run the 8 checks below. Compare source and target. Save the query results as evidence.

  7. 7

    Report and retest

    Log each mismatch as a bug with the query, the expected result and the actual result. Retest after the fix, then run the checks again for the next load.

The 8 Checks Every ETL Tester Runs

The examples below use a source table src_orders (from the online shop) and a target table dw_orders (in the warehouse). Replace the names with your own tables. The SQL works in MySQL and PostgreSQL with small changes.

1. Row count check: did every row arrive?

The quickest first test. Count rows on both sides. If the numbers differ, stop and find out why before running anything else.

01_row_count.sqlSQL
SELECT
  (SELECT COUNT(*) FROM src_orders WHERE order_date = '2026-11-01') AS source_rows,
  (SELECT COUNT(*) FROM dw_orders  WHERE order_date = '2026-11-01') AS target_rows;
-- Expected: both numbers are equal (unless the rules say some rows are filtered out)

2. Completeness check: which rows are missing?

Counts can match by luck (one row missing, one extra). This query lists the exact source rows that never reached the target. EXCEPT means "rows in the first result that are not in the second" (Oracle calls it MINUS).

02_missing_rows.sqlSQL
SELECT order_id FROM src_orders
EXCEPT
SELECT order_id FROM dw_orders;
-- Expected: no rows. Every order_id returned is a lost record.

3. Transformation check: was every value changed correctly?

Recalculate the rule yourself from the source and compare it with what the ETL wrote. This catches wrong formulas, rounding errors and currency mistakes.

03_transformation.sqlSQL
-- Rule from the mapping document:
-- total_amount = ROUND(quantity * unit_price * (1 - discount_pct / 100), 2)
SELECT s.order_id,
       ROUND(s.quantity * s.unit_price * (1 - s.discount_pct / 100), 2) AS expected_total,
       d.total_amount                                                   AS actual_total
FROM src_orders s
JOIN dw_orders  d ON d.order_id = s.order_id
WHERE d.total_amount <> ROUND(s.quantity * s.unit_price * (1 - s.discount_pct / 100), 2);
-- Expected: no rows

4. Duplicate check: did anything load twice?

Duplicates usually appear when a job is re-run after a failure, or when the same file is picked up twice. They make totals too high.

04_duplicates.sqlSQL
SELECT order_id, COUNT(*) AS copies
FROM dw_orders
GROUP BY order_id
HAVING COUNT(*) > 1;
-- Expected: no rows

5. Data quality check: blanks, bad formats and impossible values

Required columns must be filled, formats must be consistent, and values must make sense. One query can count every problem type at once.

05_data_quality.sqlSQL
SELECT
  SUM(CASE WHEN customer_email IS NULL OR customer_email = '' THEN 1 ELSE 0 END) AS missing_email,
  SUM(CASE WHEN customer_email NOT LIKE '%_@_%._%'            THEN 1 ELSE 0 END) AS bad_email_format,
  SUM(CASE WHEN total_amount < 0                              THEN 1 ELSE 0 END) AS negative_amount,
  SUM(CASE WHEN order_date > CURRENT_DATE                     THEN 1 ELSE 0 END) AS future_date
FROM dw_orders;
-- Expected: every column is 0

6. Referential integrity check: do links between tables still work?

In a warehouse, the main table (called a fact table, e.g. orders) points to lookup tables (called dimension tables, e.g. customers). Every order must point to a real customer, or that order disappears from customer reports.

06_referential_integrity.sqlSQL
SELECT f.order_id, f.customer_key
FROM dw_orders f
LEFT JOIN dw_customers c ON c.customer_key = f.customer_key
WHERE c.customer_key IS NULL;
-- Expected: no rows. Each row returned is an "orphan" order.

7. Aggregate check: do the totals match?

Business users care about totals. Compare sums per day (or per region, per product) between source and target. Even if every row looks fine, a mismatch here means something is wrong.

07_aggregates.sqlSQL
SELECT s.order_date, s.src_total, d.dw_total, s.src_total - d.dw_total AS difference
FROM (SELECT order_date, SUM(quantity * unit_price) AS src_total FROM src_orders GROUP BY order_date) s
JOIN (SELECT order_date, SUM(gross_amount)          AS dw_total  FROM dw_orders  GROUP BY order_date) d
  ON d.order_date = s.order_date
WHERE s.src_total <> d.dw_total;
-- Expected: no rows

8. Incremental load check: did only new and changed rows load?

Most jobs do not reload everything every night. They load only rows that are new or changed since the last run (an incremental load). Check that rows changed today were picked up, and that old rows were not loaded again.

08_incremental_load.sqlSQL
-- Rows changed in the source since the last successful load
SELECT s.order_id, s.updated_at, d.loaded_at
FROM src_orders s
LEFT JOIN dw_orders d ON d.order_id = s.order_id
WHERE s.updated_at > '2026-11-01 02:00:00'          -- time of the previous load
  AND (d.order_id IS NULL OR d.loaded_at < s.updated_at);
-- Expected: no rows. Each row returned is a change the job missed.

Real Example: Orders to a Sales Report

Here is how the checks come together on a small, realistic job. The shop stores orders in rupees and dollars. The warehouse must store everything in rupees, with customer names in capital letters, and must drop test orders.

Target columnSourceRule
customer_namesrc_orders.customer_nameUPPER(TRIM(customer_name))
amount_inrsrc_orders.amount, currencyIf currency = 'USD', amount × daily rate; else amount
(row filter)src_orders.is_testRows where is_test = 1 must not load

The test for these rules: count only real orders in the source, then compare each transformed value.

real_example_checks.sqlSQL
-- Count: test orders must be excluded
SELECT
  (SELECT COUNT(*) FROM src_orders WHERE is_test = 0) AS expected_rows,
  (SELECT COUNT(*) FROM dw_orders)                    AS actual_rows;

-- Name rule
SELECT s.order_id, s.customer_name, d.customer_name
FROM src_orders s JOIN dw_orders d ON d.order_id = s.order_id
WHERE d.customer_name <> UPPER(TRIM(s.customer_name));

-- Currency rule (fx_rates has one rate per day)
SELECT s.order_id, s.amount, s.currency, d.amount_inr,
       ROUND(CASE WHEN s.currency = 'USD' THEN s.amount * r.usd_to_inr ELSE s.amount END, 2) AS expected_inr
FROM src_orders s
JOIN dw_orders d ON d.order_id = s.order_id
JOIN fx_rates  r ON r.rate_date = s.order_date
WHERE d.amount_inr <> ROUND(CASE WHEN s.currency = 'USD' THEN s.amount * r.usd_to_inr ELSE s.amount END, 2);

In real projects this kind of check often finds that the job used today's exchange rate instead of the rate on the order date, a classic silent ETL bug. Every dollar order from earlier days ends up with the wrong rupee value.

Automating ETL Tests with Java

Once a check is useful, run it automatically after every load. This TestNG test connects to the warehouse with JDBC (the standard way Java talks to databases) and fails if any check query returns rows. The queries are the same SQL as above.

EtlChecksTest.javaJava
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.sql.*;
import static org.testng.Assert.assertEquals;

public class EtlChecksTest {
    private static final String URL = System.getenv("DW_URL");   // e.g. jdbc:postgresql://host:5432/dw
    private static final String USER = System.getenv("DW_USER");
    private static final String PASS = System.getenv("DW_PASSWORD");

    @DataProvider(name = "checks")
    public Object[][] checks() {
        return new Object[][] {
            {"No missing orders", "SELECT order_id FROM src_orders EXCEPT SELECT order_id FROM dw_orders"},
            {"No duplicates",     "SELECT order_id FROM dw_orders GROUP BY order_id HAVING COUNT(*) > 1"},
            {"No orphan orders",  "SELECT f.order_id FROM dw_orders f LEFT JOIN dw_customers c "
                                + "ON c.customer_key = f.customer_key WHERE c.customer_key IS NULL"},
        };
    }

    @Test(dataProvider = "checks")
    public void checkReturnsNoRows(String name, String sql) throws SQLException {
        try (Connection con = DriverManager.getConnection(URL, USER, PASS);
             Statement st = con.createStatement();
             ResultSet rs = st.executeQuery(sql)) {
            int badRows = 0;
            while (rs.next()) badRows++;
            assertEquals(badRows, 0, name + " failed: " + badRows + " bad rows");
        }
    }
}
  • Passwords come from environment variables, never from the code.
  • The @DataProvider runs the same test once per check, so adding a new check is one new line.
  • Run it in your CI/CD pipeline right after the ETL job, so a bad load is caught before anyone opens a report.

New to JDBC? The automated validation with JDBC lesson walks through the setup.

ETL Tools You Will Hear About

You do not need to master these to start. Your SQL checks work the same whichever tool moves the data.

Informatica PowerCenter / IDMC

Very common in banks and large Indian IT service companies.

Microsoft SSIS / Azure Data Factory

Used by companies on the Microsoft stack.

Talend, AWS Glue, Apache Airflow

Popular in cloud and open-source setups.

dbt

Transforms data inside cloud warehouses with SQL; has built-in tests.

QuerySurge

A tool built for ETL testing: compares source and target automatically.

Great Expectations

A Python library for writing data quality checks as code.

How to Become an ETL Tester

  1. 1.Learn SQL: SELECT, WHERE, JOIN, GROUP BY→
  2. 2.Master joins and subqueries for comparing tables→
  3. 3.Practise data validation queries→
  4. 4.Learn ETL and migration testing basics→
  5. 5.Solve SQL interview questions→

All five steps are free on TesterRank. Add a basic Java or Python course and the automation section above, and you are ready to apply for ETL tester and data QA roles.

Frequently Asked Questions

What is ETL testing in simple words?

ETL testing means checking that data was copied correctly from one system to another. You check that no rows were lost, that every value was changed (transformed) the right way, and that the final data in the target, usually a data warehouse, matches the source.

Is ETL testing manual or automation testing?

Both. Most ETL testing starts as manual testing using SQL queries: you run a query on the source, run one on the target and compare. Once the checks are stable, teams automate them with Java (JDBC and TestNG), Python (pytest) or tools such as QuerySurge, so they run after every data load.

Do I need coding for ETL testing?

You need good SQL first. SELECT, WHERE, JOIN, GROUP BY, COUNT and SUM cover most daily work. Programming (Java or Python) is a bonus that helps you automate checks and move into higher-paying data QA roles.

Is ETL testing a good career in 2026?

Yes. Every company that builds reports, dashboards or AI models depends on correct data, so data testers are needed in banking, insurance, healthcare and e-commerce. ETL testing also leads naturally into data engineering and data quality roles.

What is the difference between ETL and ELT?

In ETL the data is changed (transformed) before it is loaded into the target. In ELT the raw data is loaded first and changed inside the target, usually a cloud warehouse like Snowflake or BigQuery. The testing checks are the same: counts, completeness, transformation rules and data quality.

How long does it take to learn ETL testing?

If you already know basic SQL, about 3 to 4 weeks of daily practice is enough to learn the main checks and write test cases. If you are new to SQL, add 3 to 4 weeks to learn SQL first using the free TesterRank Database Testing path.

What are the most common bugs found in ETL testing?

Missing rows (often from a wrong join or filter), duplicate rows (from loading the same file twice), wrong calculations (for example tax or currency conversion), truncated text (a column too short in the target), wrong date formats or time zones, and NULL values where a default was expected.

Ready to Practise?

Set up a free practice database in 10 minutes and run every query on this page against real sample data.