httprunner 断言, 在源码 parser.py 中可以查看:
断言 | 断言说明 |
---|---|
"eq", "equals", "==", "is" | "实际结果"和"期望结果"相等 |
"lt", "less_than" | "实际结果"小于"期望结果" |
"le", "less_than_or_equals" | "实际结果"小于等于"期望结果" |
"gt", "greater_than" | "实际结果"大于"期望结果" |
"ge", "greater_than_or_equals" | "实际结果"大于等于"期望结果" |
"ne", "not_equals" | "实际结果"和"期望结果"不相等 |
"str_eq", "string_equals" | 转义字符串后对比,"实际结果"和"期望结果"相等 |
"len_eq", "length_equals", "count_eq" | 字符串或list长度,"实际结果"和"期望结果"相等 |
"len_gt", "count_gt", "length_greater_than", "count_greater_than" | "实际结果的长度"大于"期望结果" |
"len_ge", "count_ge", "length_greater_than_or_equals", "count_greater_than_or_equals" |
"实际结果的长度"大于等于"期望结果" |
"len_lt", "count_lt", "length_less_than", "count_less_than" | "实际结果的长度"小于"期望结果" |
"len_le", "count_le", "length_less_than_or_equals", "count_less_than_or_equals" |
"实际结果的长度"小于等于"期望结果" |
提取变量 | 说明 |
em validate(.*)TOC em | 使用正则提取变量 |
content.data.name | 使用json提取变量 |