Skip to content

Commit

Permalink
docs: give more examples of the verify (#590)
Browse files Browse the repository at this point in the history
Signed-off-by: Rick <[email protected]>
  • Loading branch information
LinuxSuRen authored Jan 6, 2025
1 parent 87fe3ee commit 73d71a3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/site/content/zh/latest/tasks/verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ title = "测试用例验证"
## 数组值检查
### 检查数组中是否有元素的字段包含特定值
示例数据:
```json
{
"data": [{
"key": "Content-Type"
}]
}
```

校验配置:

```yaml
- name: popularHeaders
request:
Expand All @@ -28,6 +42,19 @@ title = "测试用例验证"
- any(data.data, {.key == "Content-Type"})
```
### 检查数组中是否有元素的字段只包含特定值
校验配置:
```yaml
- name: popularHeaders
request:
api: /popularHeaders
expect:
verify:
- all(data.data, {.key == "Content-Type" or .key == "Target"})
```
[更多用法](https://expr-lang.org/docs/language-definition#any).
## 字符串判断
Expand Down

0 comments on commit 73d71a3

Please sign in to comment.