@kirrosh/zond 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -68,20 +68,30 @@ name: Suite Name # required
|
|
|
68
68
|
base_url: "{{base_url}}" # or hardcoded URL
|
|
69
69
|
tags: [smoke] # optional: smoke | crud | destructive | auth
|
|
70
70
|
tests:
|
|
71
|
-
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
- name: Get all items # required
|
|
72
|
+
GET: /items # method as YAML key, path as value
|
|
73
|
+
query: { limit: 10 }
|
|
74
|
+
expect:
|
|
75
|
+
status: 200
|
|
76
|
+
_body: { type: array, length_gt: 0 }
|
|
76
77
|
\`\`\`
|
|
77
78
|
|
|
78
|
-
###
|
|
79
|
+
### Path parameters
|
|
80
|
+
Inline the value directly — there is NO \`params\` field:
|
|
81
|
+
\`\`\`yaml
|
|
82
|
+
- name: Get item by ID
|
|
83
|
+
GET: /items/1 # hardcoded
|
|
84
|
+
- name: Get captured item
|
|
85
|
+
GET: /items/{{item_id}} # from prior capture
|
|
86
|
+
\`\`\`
|
|
87
|
+
|
|
88
|
+
### Assertion operators (use inside expect)
|
|
79
89
|
| Operator | Example |
|
|
80
90
|
|----------|---------|
|
|
81
91
|
| equals (default) | \`status: 200\` |
|
|
82
92
|
| not_equals | \`status: { not_equals: 500 }\` |
|
|
83
93
|
| contains | \`name: { contains: "john" }\` |
|
|
84
|
-
| not_contains | \`
|
|
94
|
+
| not_contains | \`error: { not_contains: "fatal" }\` |
|
|
85
95
|
| exists / not_exists | \`id: { exists: true }\` |
|
|
86
96
|
| gt / gte / lt / lte | \`count: { gte: 1 }\` |
|
|
87
97
|
| matches (regex) | \`email: { matches: "^.+@.+$" }\` |
|
|
@@ -90,33 +100,46 @@ tests:
|
|
|
90
100
|
| length_gt/gte/lt/lte | \`items: { length_gt: 0 }\` |
|
|
91
101
|
|
|
92
102
|
### Body assertions
|
|
93
|
-
- \`_body\` — assert on
|
|
103
|
+
- \`_body\` — assert on root response body: \`_body: { type: array }\`
|
|
104
|
+
- Combine operators in one key: \`_body: { type: array, length_gt: 0 }\`
|
|
94
105
|
- Dot-notation for nested: \`data.user.id: { exists: true }\`
|
|
95
|
-
- Array
|
|
106
|
+
- Array element: \`items.0.name: { exists: true }\`
|
|
107
|
+
- YAML keys must be unique — do NOT repeat \`_body\` twice
|
|
96
108
|
|
|
97
109
|
### Request body (JSON)
|
|
98
110
|
\`\`\`yaml
|
|
99
|
-
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
111
|
+
- name: Create resource
|
|
112
|
+
POST: /resources
|
|
113
|
+
json: { name: "test", email: "a@b.com" }
|
|
114
|
+
expect:
|
|
115
|
+
status: 201
|
|
116
|
+
id: { exists: true }
|
|
103
117
|
\`\`\`
|
|
104
118
|
|
|
105
119
|
### Built-in generators
|
|
106
|
-
\`{{$uuid}}\`, \`{{$randomInt}}\`, \`{{$timestamp}}\`, \`{{$
|
|
120
|
+
\`{{$uuid}}\`, \`{{$randomInt}}\`, \`{{$timestamp}}\`, \`{{$randomName}}\`, \`{{$randomEmail}}\`, \`{{$randomString}}\`
|
|
107
121
|
|
|
108
122
|
### Variable capture & interpolation
|
|
109
123
|
\`\`\`yaml
|
|
110
|
-
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
- name: Create item
|
|
125
|
+
POST: /items
|
|
126
|
+
json: { name: "test-{{$uuid}}" }
|
|
127
|
+
capture:
|
|
128
|
+
created_id: id # saves response.id
|
|
129
|
+
expect:
|
|
130
|
+
status: 201
|
|
131
|
+
|
|
132
|
+
- name: Get created item
|
|
133
|
+
GET: /items/{{created_id}}
|
|
134
|
+
expect:
|
|
135
|
+
status: 200
|
|
136
|
+
id: { equals: "{{created_id}}" }
|
|
119
137
|
\`\`\`
|
|
138
|
+
|
|
139
|
+
### Coverage matching
|
|
140
|
+
Use spec paths with \`{param}\` placeholders in the path for coverage to match:
|
|
141
|
+
- Spec says \`GET /products/{id}\` → write \`GET: /products/1\` (hardcode the value)
|
|
142
|
+
- Coverage scanner matches test paths against spec paths automatically
|
|
120
143
|
`;
|
|
121
144
|
|
|
122
145
|
export interface GuideOptions {
|