Interface automation test-HttpRunner

Interface request type

Insert picture description here

Http1.1:get、post、head、options、put、delete、trace、connect

The four commonly used are: get, post, put, delete,
options: return the http request method supported by the server for a specific resource, allowing the client to view the performance of the server
head: ask the server for a response consistent with the GET request, but The response body will not be returned. This method can obtain the meta information contained in the response message header without having to transmit the entire response content.
get: Make a request to a specific resource and return the entity subject.
post: Submit data to the specified resource for processing request (such as submitting a form or uploading a file). The data is contained in the request body. POST requests may result in the creation of new resources and/or the modification of existing resources.
put: Upload the latest content to the specified resource location, and the data transmitted from the client to the server replaces the content of the specified document.
delete: request the server to delete the resource identified by the Request-URI, that is, delete the specified page
trace: echo the request received by the server, mainly used for testing or diagnosis
connect: HTTP/1.1 protocol is reserved to be able to change the connection It is a proxy server in a pipeline mode. The
above source: https://www.cnblogs.com/yueyanru/p/9487980.html

Interface parameter type

data: post form parameters

Insert picture description here

params: get request parameters

Insert picture description here

json: json data

Insert picture description here

Method for judging the correctness of interface results

1. Whether the actual result and the expected result are equal: 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_equals 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_equals or ge
#Meaning: check_value >= expect_value
“validate”: [
{“check”: “check_value”, “comparator”: “ge”, “expect”: “expect_value”}
]
6. The actual result and the expected result are not equal: not_equals or ne
Meaning: check_value != expect_value
“validate”: [
{“check”: “check_value”, “comparator”: “ne”, “expect”: “expect_value”}
]
7. Whether the actual result and the expected result are equal: 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. Is the length of the actual result equal to the expected result: length_equals or len_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_equals or len_ge or count_ge or The
meaning of count_greater_than_or_equals : 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_equals or len_le or count_le or count_less_than_or_equals
meaning: len(check_value) <= expect_value
“validate”: [
{“check”: “check_value”, “comparator”: “len_ge”, “expect”: “expect_value”}
]
13. The actual result contains the expected result: contains
meaning: expect_value in check_value
“validate” ": [
{"check":"check_value", "comparator": "contains", "expect": "expect_value"}
]
14. The actual result is expected to contain: contained_by
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 the expected result: type_match
meaning: isinstance(check_value, get_type(expect_value))
“validate”: [
{“check”: “check_value”, “comparator”: “len_ge”, “expect”: "Fill in the field type of the expected value in this position, for example: int, float, str, list, dic, etc."}
]
16. Check whether the actual result and the expected result are both instances of basestring, and if they are both, use regular matching of the two inputs Parameter: regex_match
meaning:
"validate": [
{"check": "check_value", "comparator": "regex_match", "expect": "Use regular expressions to fill in the expected result at this position"}
]
17. Verify whether check_value has been expect_value start: startswith #Meaning
: builtin_str(check_value).startswith(builtin_str(expect_value))
“validate”: [
{“check”: “check_value”, “comparator”: “startswith”, “expect”: “expect_value”}
]
18. Verify that check_value has ended with expect_value: endswith
#含义:builtin_str(check_value).endswith(builtin_str(expect_value))
“validate”: [
{“check”:“check_value”, “comparator”: “endswith”, “expect”: “expect_value”}
]

The source of the method for judging the correctness of the interface result: https://www.jianshu.com/p/0367fb6ab5a2

Guess you like

Origin blog.csdn.net/weixin_43533308/article/details/103363343