首页 > 技术文章 > HttpRunner接口自动化测试框架--3.2validate详细描述

XhyTechnologyShare 2019-12-17 17:55 原文

测试用例中定义的结果校验项,作用域为当前测试用例,用于实现对当前测试用例运行结果的校验

校验的详细描述:

No.
Comparator
Description
A(check), B(expect)
1 eq value is equal A == B
2 lt less than A < B
3 le less than or equals A <=B
4 gt greater than A >B
5 ge greater than or equals A >=B
6 ne not equals A != B
7 str_eq string equals str(A) == str(B)
8 len_eq, count_eq length or count equals len(A) == B
9 len_gt,count_gt length greater than len(A) > B
10 len_ge,count_ge length greater than or equals len(A) >= B
11 len_lt, count_lt length less than len(A) < B
12 len_le, count_le length less than or equals len(A) <= B
13 contains contains

[1,2] contains 1

14 contained_by contained by A in B
15 type_match A is instance of B isinstance(A, B)
16 regex_match regex matches re.match(B, A)
17 startwith start with A startwith(B) is True
('abc' startwith 'ab')
18 endswith ends with A endswith(B) is True
('abc' endswith 'bc')

推荐阅读