بنقرة واحدة
add-integration-test
Create a new integration test for dbt-autofix with proper folder structure and golden files
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Create a new integration test for dbt-autofix with proper folder structure and golden files
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | add-integration-test |
| description | Create a new integration test for dbt-autofix with proper folder structure and golden files |
| disable-model-invocation | true |
| argument-hint | ["project-name"] |
| allowed-tools | Read, Write, Bash, Glob, Grep, Edit |
Create a new integration test for dbt-autofix. Integration tests verify that the refactor tool correctly transforms dbt projects.
Integration tests document DESIRED behavior, not current behavior.
This approach:
Using GOLDIE_UPDATE: Run with GOLDIE_UPDATE=1 to understand current behavior, but don't blindly accept it as the expected output. Manually craft the _expected files to reflect what the behavior should be.
$ARGUMENTS - The test project name (e.g., config_quoted_strings)Running a single test:
uv run pytest "tests/integration_tests/test_full_dbt_projects.py::test_project_refactor[project_<name>]" -v
Example for a project named config_quoted_strings:
uv run pytest "tests/integration_tests/test_full_dbt_projects.py::test_project_refactor[project_config_quoted_strings]" -v
Naming guidance: Use descriptive names that explain what the test covers, not issue numbers. For example:
config_quoted_strings (not issue_221)python_model_meta_config (not issue_220)jinja_unmatched_endifThe name becomes project_<name> in the test projects directory.
Each integration test requires 3 artifacts in tests/integration_tests/dbt_projects/:
project_<name>/ - Input dbt project (before refactor)
dbt_project.yml + model files in models/project_<name>_expected/ - Expected output (after refactor)
project_<name>_expected.stdout - Expected JSON log output
Reference the README for the authoritative list of deprecations: README.md
Discover existing test projects to see patterns and avoid duplication:
ls tests/integration_tests/dbt_projects/ | grep -v _expected
Ask the user:
--behavior-change mode--semantic-layer modeRun with GOLDIE_UPDATE=1 to see what the tool currently does:
GOLDIE_UPDATE=1 uv run pytest "tests/integration_tests/test_full_dbt_projects.py::test_project_refactor[project_<name>]" -v
Note: Do NOT commit the auto-generated _expected files from GOLDIE_UPDATE without review. They reflect current behavior, not necessarily desired behavior. Manually craft the expected output to reflect what the behavior should be.
tests/integration_tests/dbt_projects/
├── project_<name>/
│ ├── dbt_project.yml
│ └── models/
│ └── <model>.sql (or .py for Python models)
├── project_<name>_expected/
│ ├── dbt_project.yml
│ └── models/
│ └── <model>.sql
└── project_<name>_expected.stdout
Minimal dbt_project.yml:
name: '<test name>'
version: '1.0.0'
config-version: 2
profile: 'default'
model-paths: ["models"]
Create model files that demonstrate the behavior being tested. The input should contain the pattern that triggers the deprecation/refactor.
Manually create the _expected files showing what the output SHOULD be after the fix/feature is implemented. Do NOT just copy current behavior.
Write the JSON log output that SHOULD be produced. Each line is a JSON object:
{"mode": "applied", "file_path": "...", "refactors": [{"deprecation": "...", "log": "..."}]}
{"mode": "complete"}
If the test requires --behavior-change or --semantic-layer, add an entry to the dicts in tests/integration_tests/test_full_dbt_projects.py:
project_dir_to_behavior_change_mode["project_<name>"] = True
# or
project_dir_to_semantic_layer_mode["project_<name>"] = True
# Should fail (or xfail) if feature not implemented
uv run pytest "tests/integration_tests/test_full_dbt_projects.py::test_project_refactor[project_<name>]" -v
# Should pass once feature is implemented
GOLDIE_UPDATE=1 shows current behavior - use for understanding, not as source of truthfile_path key is ignored during comparison (paths don't need to match)_expected suffix must match exactlyproject_config_quoted_strings/ with a model containing the problematic quoted stringproject_config_quoted_strings_expected/ showing correct handling (no error, proper transformation)project_python_model_meta_config/ with a Python model using dbt.config.get("custom_key")project_python_model_meta_config_expected/ showing the Python code updated to dbt.config.get("meta").get("custom_key")