测试用例验证
[i18n] post_less_than_a_minute_read
atest
采用 https://expr.medv.io 对 HTTP 请求响应的验证,比如:返回的数据列表长度验证、具体值的验证等等。下面给出一些例子:
需要注意的是,
data
指的是 HTTP Response Body(响应体)的 JSON 对象。
数组长度判断
- name: projectKinds
request:
api: /api/resources/projectKinds
expect:
verify:
- len(data.data) == 6
数组值检查
- name: popularHeaders
request:
api: /popularHeaders
expect:
verify:
- any(data.data, {.key == "Content-Type"})
更多用法.
字符串判断
- name: metrics
request:
api: |
{{.param.server}}/metrics
expect:
verify:
- indexOf(data, "atest_execution_count") != -1
更多用法.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.
[i18n] post_last_mod November 18, 2024: feat: support to generate robot-framework script (#563) (0f02984)