RBR-OS
[G]ITHUB v2026.10 · APACHE-2.0

Unit tests

Google Cloud Dataform Plugin for IntelliJ · Features

Dataform unit tests check the output of a table or view against fixed input data. The plugin creates them for you, helps you write them and runs them in BigQuery.

VID.01 // Creating, running and fixing test_gold_customer_ltv.sqlx

Create a test

Right-click a SQLX or JavaScript file that defines a table or view, in the editor or the Project view, and choose Create Dataform Test. When the file defines several actions, the plugin asks which ones to test.

The test is written to definitions/tests/test_<action>.sqlx, with an input block for each table the action reads and the expected output, pre-filled from the columns known for each table. A table whose columns are not known yet gets a placeholder row. Existing test files are left untouched. Test files have their own icon in the Project view.

VID.02 // Create Dataform Test on gold_daily_sales.sqlx in the Project view

Write the test

  • Completion suggests the inputs of the tested action and their columns.
  • Ctrl+Click on the tested dataset or an input jumps to its definition.
  • In an input block or the expected output, the Generate SELECT from schema of … intention (Alt+Enter), named after the table, writes a SELECT listing every column of the table with a placeholder value of its type, including STRUCT and repeated columns.
  • Renaming a column of the tested action or of an input table also renames it in the test. See Column refactoring.
FIG.01 // Generate SELECT from schema of silver_orders, with its preview

The Test view of the split editor shows the compiled Test query, the tested action’s query run on your inputs, and the Expected output. Run test query runs either of them in BigQuery, to see what the test compares.

FIG.02 // The Test view of test_gold_customer_ltv.sqlx

Run tests

Run a test with Run test in the editor toolbar or from the gutter of its file, or create a Dataform Unit Tests run configuration to run a file, a directory or all the tests of the project. The plugin compiles the project, runs the tests in BigQuery and compares the rows the way dataform test does.

FIG.03 // A Dataform Unit Tests run configuration

Results appear in the IDE test runner. A failed test names the row and column that differ, or the row count or columns that do not match: For row 0 and column “lifetime_value”: expected “650”, but saw “600”. Click to see difference opens the expected and actual rows side by side.

FIG.04 // A failing test in the test runner
FIG.05 // Expected and actual rows of the failing test
FIG.06 // The same test passing once the expected output is fixed

Tests run in the GCP project of the active repository, so they need the Google Cloud sign-in and a repository selected in the Dataform panel.