Skip to main content

Test Selection

Test selection is what makes DAGZ skip tests that are not affected by a code change. The mechanism is a dependency graph plus content fingerprints, both built from previous test runs.

Baselines

A baseline is a snapshot from a previous job: the dependency graph plus content fingerprints for every code element observed during that run. Baselines are compressed and stored efficiently.

A baseline can be built out of previous baselines plus dependencies collected during the current run. This means that even if you run a single test, you get a full baseline for the entire codebase.

Multiple baselines

DAGZ automatically picks two baselines for each new job: the latest from the current branch, and the latest from the project's main branch. Test selection is the union: a test is selected if either baseline says the change might affect it.

Because the optimized coverage collector regenerates baselines on every job at negligible cost, you always have up-to-date baselines to compare against.

What "affected" means

When a new job starts, DAGZ compares the baselines' code fingerprints to the new code and walks the dependency graph to determine which tests are impacted.

  • Changed a function? Only tests that call it (directly or indirectly) are selected.
  • Changed a module-level variable? Tests that read it are selected.
  • Deleted a module? All tests that imported from it are selected.
  • Reformatted code without logic changes? Nothing is selected. DAGZ tracks logic, not whitespace.

You get a full trace of the selection process for each selected test, visible in the test logs or via zb select-tests --trace.

Configuration

DAGZ works with zero configuration. Project settings and selection-related feature flags live in .dagz/config.yaml; see Configuration Reference for the full schema.