Summary of comparison methods of validate in httprunner

Keywords: PHP less github

1. Whether the actual result is equal to the expected result: equals or eq or = = or is

# Meaning: check_value == expect_value
"validate": [
                {"check":"check_value", "comparator": "eq", "expect": "expect_value"}
            ]

2. The actual result is less than the expected result: less than or lt

# Meaning: check value < expect value
"validate": [
                {"check":"check_value", "comparator": "lt", "expect": "expect_value"}
            ]

3. The actual result is less than or equal to the expected result: less than or equal or le

# Meaning: check value < = expect value
"validate": [
                {"check":"check_value", "comparator": "le", "expect": "expect_value"}
            ]

4. The actual result is greater than the expected result: greater than or gt

# Meaning: check value > expect value
"validate": [
                {"check":"check_value", "comparator": "gt", "expect": "expect_value"}
            ]

5. The actual result is greater than or equal to the expected result: greater than or equal to or ge

# Meaning: check value > = expect value
"validate": [
                {"check":"check_value", "comparator": "ge", "expect": "expect_value"}
            ]

6. The actual result is not equal to the expected result: not equals or ne

# Meaning: check value! = expect value
"validate": [
                {"check":"check_value", "comparator": "ne", "expect": "expect_value"}
            ]

7. Whether the actual result is equal to the expected result: string_equals or str_eq

# Meaning: builtin? Str (check? Value) = = builtin? Str (expect? Value)
"validate": [
                {"check":"check_value", "comparator": "str_eq", "expect": "expect_value"}
            ]

8. Whether the length of the actual result is equal to the expected result: length equals or length EQ or count EQ

# Meaning: len (check value) = = expect value
"validate": [
                {"check":"check_value", "comparator": "len_eq", "expect": "expect_value"}
            ]

9. The length of the actual result is greater than the expected result: length ﹐ greater than or len ﹐ GT or count ﹐ GT or count ﹐ greater than

# Meaning: len (check value) > expect value
"validate": [
                {"check":"check_value", "comparator": "len_gt", "expect": "expect_value"}
            ]

10. The length of the actual result is greater than or equal to the expected result: length ﹐ greater than or equal to, or length ﹐ or count ﹐ or count ﹐ greater than or equal to

# Meaning: len (check value) > = expect value
"validate": [
                {"check":"check_value", "comparator": "len_ge", "expect": "expect_value"}
            ]

11. The length of the actual result is less than the expected result: length \ less \ than or len \ lt or count \ lt or count \ less \ than

# Meaning: len (check value) < expect value
"validate": [
                {"check":"check_value", "comparator": "len_lt", "expect": "expect_value"}
            ]

12. The length of the actual result is less than or equal to the expected result: length ﹐ less than or equal to or count ﹐ or count ﹐ less than or equal to

# Meaning: len (check value) < = expect value
"validate": [
                {"check":"check_value", "comparator": "len_ge", "expect": "expect_value"}
            ]

13. The actual results include the expected results: contains

# Meaning: expect "value in check" value
"validate": [
                {"check":"check_value", "comparator": "contains", "expect": "expect_value"}
            ]

14. The actual result is included by the expected result.

# Meaning: check value in expect value
"validate": [
                {"check":"check_value", "comparator": "contained_by", "expect": "expect_value"}
            ]

15. The field type of the actual result is the same as that of the expected result: type "match

# Meaning: isinstance (check value, get type (expect value))
"validate": [
                {"check":"check_value", "comparator": "len_ge", "expect": "Fill in the expected field type in this position, for example: int,float,str,list,dic Wait"}
            ]

16. Check whether the actual result and the expected result are instances of basestring. If both are instances, use regular matching to match the two input parameters: regex [match].

# Meaning:
"validate": [
                {"check":"check_value", "comparator": "regex_match", "expect": "This position uses regular expressions to fill in the expected results"}
            ]

17. Verify whether the check value has been expected value started: startswitch

# Meaning: builtin? Str (check? Value). Startswitch (builtin? Str (expect? Value))
"validate": [
                {"check":"check_value", "comparator": "startswith", "expect": "expect_value"}
            ]

18. Verify whether the check value has ended with expect value: endswitch

# Meaning: builtin? Str (check? Value). Endswitch (builtin? Str (expect? Value))
"validate": [
                {"check":"check_value", "comparator": "endswith", "expect": "expect_value"}
            ]

Reference documents: https://github.com/HttpRunner/HttpRunner/blob/master/httprunner/utils.py
https://github.com/HttpRunner/HttpRunner/blob/master/httprunner/built_in.py



Posted by feelay on Wed, 23 Oct 2019 07:33:49 -0700