Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading