You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 896c452
Browse filesBrowse the repository at this point in the historyBrowse files
feat(test): select unit tests by name and require unique test names (#989)
* feat(test): require globally unique unit-test and scenario names
Unit-test names (TEST name or file stem) and scenario names now join the
global resource-name rule with models, sources, seeds, functions, Python
nodes, providers and hooks. A clash is a compile error naming both kinds and
files; cases of one parameterized test share its name. Fixtures that named a
test or scenario after its model are renamed.
* feat(test): select unit tests by name
sqb test and sqb build accept a unit-test name, bare or as test:<name>, with
glob patterns. Test selectors union with resource selectors, --case still
narrows, and selecting only tests runs them without building models. Every
other command rejects unit-test selectors with S013, and unknown names
suggest the closest selectable names.
Copy file name to clipboardExpand all lines: src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/build.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,7 @@ own option. `--version` works only directly after `sqb`, as in `sqb --version`:
72
72
|`--selection-diagnostics`| Warn when a selected model will build on changed upstream models that are not selected; see [Selection and staleness](../concepts/planning/selection-and-staleness.md)|
73
73
|`--manifest`| Generate `target/manifest.json` with plan-aware project metadata |
74
74
|`SELECTOR ...`| Positional selectors, the same as `--select`|
75
-
|`--select`, `-s`| Select specific models |
75
+
|`--select`, `-s`| Select specific models, or unit tests by name (`test:<name>`); selecting only unit tests runs them without building models|
76
76
|`--exclude`| Exclude specific models |
77
77
|`--warehouse <name>`| Snowflake warehouse for this invocation; overrides the target's `build`[warehouse group](../concepts/project-configuration.md#command-group-warehouses) and the connection warehouse |
Copy file name to clipboardExpand all lines: src/sqlbuild/.agents/skills/sqlbuild/references/docs/cli/test.md
+17-4Lines changed: 17 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,12 +23,19 @@ Positional `SELECTOR` arguments work like `--select`, and both forms can be comb
23
23
|------|-------------|
24
24
|`--no-sql-analysis`| Disable compile-time SQL analysis (`--no-sql-validation` is an alias) |
25
25
|`SELECTOR ...`| Positional selectors, the same as `--select`|
26
-
|`--select`, `-s`| Select tests targeting specific models |
27
-
|`--exclude`| Exclude tests targeting specific models |
26
+
|`--select`, `-s`| Select tests by name (`order_status_rules` or `test:order_status_rules`), or the tests targeting specific models |
27
+
|`--exclude`| Exclude tests by name, or the tests targeting specific models |
28
28
|`--warehouse <name>`| Snowflake warehouse for this invocation; overrides the target's `query`[warehouse group](../concepts/project-configuration.md#command-group-warehouses) and the connection warehouse |
29
29
30
-
Parameterized cases use parent-level selection. Selecting a target model includes every case in
31
-
each matching `TEST` template; case names are not model selectors.
30
+
Test names are globally unique, so a bare test name selects exactly that test. `test:<name>` is the
31
+
explicit form and accepts the same glob patterns as names, such as `test:orders_*`. A bare pattern
32
+
selects tests only when it matches no other resource. Test selectors are unioned with model
33
+
selectors, so `sqb test test:order_status_rules stg_orders` runs that test and every test targeting
34
+
`stg_orders`. Test selectors cannot use `+` graph expansion or `,` intersection. Only `sqb test` and
35
+
`sqb build` accept test selectors; other commands reject them with `S013`.
36
+
37
+
Parameterized cases use parent-level selection. Selecting a test or a target model includes every
38
+
case of each matching `TEST` template, and `--case` narrows the run to one case name.
32
39
33
40
Text output identifies each case as `<parent> [<case>]` and includes its source path and safe typed
34
41
parameters. Structured JSON emits one check per case with stable source/block/case identity,
Copy file name to clipboardExpand all lines: src/sqlbuild/.agents/skills/sqlbuild/references/docs/concepts/scenarios.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ tests/
44
44
fulfillment__late_shipment.sql
45
45
```
46
46
47
-
Folders are organizational only. The scenario name is the filename stemand must be globally unique across all discovered scenario files.
47
+
Folders are organizational only. The scenario name is the filename stem. Like model, source, seed, and unit-test names, it must be globally unique across the project.
0 commit comments