docs: give more examples of the verify (#590)
Signed-off-by: Rick <1450685+LinuxSuRen@users.noreply.github.com>
This commit is contained in:
parent
87fe3ee61a
commit
73d71a3321
|
@ -19,6 +19,20 @@ title = "测试用例验证"
|
||||||
|
|
||||||
## 数组值检查
|
## 数组值检查
|
||||||
|
|
||||||
|
### 检查数组中是否有元素的字段包含特定值
|
||||||
|
|
||||||
|
示例数据:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"data": [{
|
||||||
|
"key": "Content-Type"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
校验配置:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: popularHeaders
|
- name: popularHeaders
|
||||||
request:
|
request:
|
||||||
|
@ -28,6 +42,19 @@ title = "测试用例验证"
|
||||||
- any(data.data, {.key == "Content-Type"})
|
- 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).
|
[更多用法](https://expr-lang.org/docs/language-definition#any).
|
||||||
|
|
||||||
## 字符串判断
|
## 字符串判断
|
||||||
|
|
Loading…
Reference in New Issue