← All updates Databricks Update One-Pager Navy version
databricks Platform · Updated Jul 26, 2026

Unit Testing for Pipelines

Enhance your Spark Declarative Pipelines with robust unit testing capabilities.

What it does

This feature allows users to write and execute Python unit tests for Spark Declarative Pipelines directly within the Lakeflow Pipelines Editor. It supports validation of Python and SQL transformation logic against mock data, enabling testing of edge cases and proprietary pipeline APIs such as Auto CDC and streaming tables. The framework provides isolated test execution by redirecting table operations to a temporary test schema, ensuring that production data remains unaffected during testing.

Why it matters

By enabling unit testing, data teams can significantly improve the reliability and quality of their data transformations, reducing the risk of errors in production. This leads to enhanced productivity as teams can validate changes before deployment, ensuring that business logic is correctly implemented. Ultimately, this feature supports better governance and data quality, which are critical for organizations relying on accurate data insights.

Key capabilities
Isolated Test Execution
Tests run in a temporary schema, preventing any impact on production data.
Flexible Test Scope
Allows testing of individual tables, chains of dependent tables, or entire pipelines.
Result Validation
Utilizes standard pytest assertions to verify the correctness of test outputs.
Mock Data Support
Facilitates the creation of mock data for testing various scenarios and edge cases.
Prerequisites
Pipeline Owner permission
USE CATALOG and CREATE SCHEMA privileges on the pipeline's default catalog
Pipeline must be configured in triggered (non-continuous) mode
Pipeline must be on the PREVIEW channel
Recommended use cases
Validating new transformation logic before production deployment.Testing Auto CDC specifications to ensure correct processing of change events.Verifying data quality rules and expectations.Testing data flows across dependent tables in a pipeline.
Limitations · remember
!Test isolation is only effective for table operations referenced by name.
!Concurrent execution of tests and pipeline updates is unsupported.
!Governance and DDL operations are not allowed during tests.
!Temporary schemas may remain after abnormal test termination.
Architecture
Lakeflow Pipelines Editor → Unit Testing Framework → Temporary Test Schema → SparkSession
Get started
1
Update Pipeline Settings
Configure the pipeline to run on the PREVIEW channel in triggered mode.
2
Create a Test File
In the Lakeflow Pipelines Editor, create a test file to begin writing tests.
3
Generate Tests
Use Genie Code to generate test scaffolding or write your own test code.
4
Run Tests
Execute tests from the Lakeflow Pipelines Editor and review results.
Key takeaway
Unit testing for pipelines empowers data teams to validate transformations, enhancing data quality and reducing production risks.
2026-07-26-unit-testing-for-pipelines-beta Generated by the Databricks Updates Agent · browse all updates