Skip to content

Commit 73d71a3

Browse files
authored
docs: give more examples of the verify (#590)
Signed-off-by: Rick <[email protected]>
1 parent 87fe3ee commit 73d71a3

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/site/content/zh/latest/tasks/verify.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ title = "测试用例验证"
1919
2020
## 数组值检查
2121
22+
### 检查数组中是否有元素的字段包含特定值
23+
24+
示例数据:
25+
26+
```json
27+
{
28+
"data": [{
29+
"key": "Content-Type"
30+
}]
31+
}
32+
```
33+
34+
校验配置:
35+
2236
```yaml
2337
- name: popularHeaders
2438
request:
@@ -28,6 +42,19 @@ title = "测试用例验证"
2842
- any(data.data, {.key == "Content-Type"})
2943
```
3044
45+
### 检查数组中是否有元素的字段只包含特定值
46+
47+
校验配置:
48+
49+
```yaml
50+
- name: popularHeaders
51+
request:
52+
api: /popularHeaders
53+
expect:
54+
verify:
55+
- all(data.data, {.key == "Content-Type" or .key == "Target"})
56+
```
57+
3158
[更多用法](https://expr-lang.org/docs/language-definition#any).
3259
3360
## 字符串判断

0 commit comments

Comments
 (0)