name: dbt-helpers-golden-e2e description: Implement and run End-to-End tests using golden output comparison. Use when verifying CLI behavior, plan generation, or full project execution.
dbt-helpers-golden-e2e
Purpose
To ensure that the CLI and core orchestrator produce the expected results for a given project state. Golden tests provide a high-level safety net for the entire system.
Workflow
- Setup: Use sample dbt projects in
integration_tests/. - Execute: Run the
dbthCLI command with a specific configuration. - Compare: Compare the generated plan (JSON/Text) or the final file state against "Golden" files stored in version control.
Instructions
When writing an E2E test
- Identify or create a sample dbt project in
integration_tests/. - Run the command and capture the output (e.g.,
dbth source generate --plan). - If this is a new test, save the output as the initial golden file.
- If this is an existing test, verify that the output matches the golden file.
When updating behavior
- If the change is intentional, update the golden files (e.g.,
pytest --update-goldens). - Verify the diff to ensure no unexpected changes occurred.