mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-22 17:00:17 +08:00
validate: set expect as alias for expected
This commit is contained in:
@@ -40,8 +40,8 @@ And here is testset example of typical scenario: get `token` at the beginning, a
|
||||
extract:
|
||||
- token: content.token
|
||||
validate:
|
||||
- {"check": "status_code", "comparator": "eq", "expected": 200}
|
||||
- {"check": "content.token", "comparator": "len_eq", "expected": 16}
|
||||
- {"check": "status_code", "comparator": "eq", "expect": 200}
|
||||
- {"check": "content.token", "comparator": "len_eq", "expect": 16}
|
||||
|
||||
- test:
|
||||
name: create user which does not exist
|
||||
@@ -54,8 +54,8 @@ And here is testset example of typical scenario: get `token` at the beginning, a
|
||||
name: "user1"
|
||||
password: "123456"
|
||||
validate:
|
||||
- {"check": "status_code", "comparator": "eq", "expected": 201}
|
||||
- {"check": "content.success", "comparator": "eq", "expected": true}
|
||||
- {"check": "status_code", "comparator": "eq", "expect": 201}
|
||||
- {"check": "content.success", "comparator": "eq", "expect": true}
|
||||
|
||||
Function invoke is supported in `YAML/JSON` format testcases, such as `gen_random_string` and `get_sign` above. This mechanism relies on the `debugtak.py` hot plugin, with which we can define functions in `debugtak.py` file, and then functions can be auto discovered and invoked in runtime.
|
||||
|
||||
@@ -68,7 +68,7 @@ Comparator
|
||||
``HttpRunner`` currently supports the following comparators.
|
||||
|
||||
+---------------------------+---------------------------+-------------------------+--------------------------+
|
||||
| comparator | Description | A(check), B(expected) | examples |
|
||||
| comparator | Description | A(check), B(expect) | examples |
|
||||
+===========================+===========================+=========================+==========================+
|
||||
| ``eq``, ``==`` | value is equal | A == B | 9 eq 9 |
|
||||
+---------------------------+---------------------------+-------------------------+--------------------------+
|
||||
@@ -171,11 +171,11 @@ There might be slight difference on list, cos we can use index to locate list it
|
||||
- content_type: headers.content-type
|
||||
- first_name: content.person.name.first_name
|
||||
validate:
|
||||
- {"check": "status_code", "comparator": "eq", "expected": 200}
|
||||
- {"check": "headers.content-type", "expected": "application/json"}
|
||||
- {"check": "headers.content-length", "comparator": "gt", "expected": 40}
|
||||
- {"check": "content.success", "comparator": "eq", "expected": True}
|
||||
- {"check": "content.token", "comparator": "len_eq", "expected": 16}
|
||||
- {"check": "status_code", "comparator": "eq", "expect": 200}
|
||||
- {"check": "headers.content-type", "expect": "application/json"}
|
||||
- {"check": "headers.content-length", "comparator": "gt", "expect": 40}
|
||||
- {"check": "content.success", "comparator": "eq", "expect": True}
|
||||
- {"check": "content.token", "comparator": "len_eq", "expect": 16}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user