mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-03 14:59:38 +08:00
update doc string
This commit is contained in:
@@ -54,10 +54,21 @@ class TestRunner(object):
|
|||||||
"request": {},
|
"request": {},
|
||||||
"response": {}
|
"response": {}
|
||||||
}
|
}
|
||||||
@return (dict) variables binds mapping
|
@return (dict) parsed testcase with bind values
|
||||||
{
|
{
|
||||||
"TOKEN": "debugtalk",
|
"request": {
|
||||||
"random": "A2dEx"
|
"url": "http://127.0.0.1:5000/api/users/1000",
|
||||||
|
"method": "POST",
|
||||||
|
"headers": {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"authorization": "a83de0ff8d2e896dbd8efb81ba14e17d",
|
||||||
|
"random": "A2dEx"
|
||||||
|
},
|
||||||
|
"body": '{"name": "user", "password": "123456"}'
|
||||||
|
},
|
||||||
|
"response": {
|
||||||
|
"status_code": 201
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
self.pre_config(testcase)
|
self.pre_config(testcase)
|
||||||
|
|||||||
@@ -14,25 +14,36 @@ class TestcaseParser(object):
|
|||||||
def parse(self, testcase_template):
|
def parse(self, testcase_template):
|
||||||
""" parse testcase_template, replace all variables with bind value.
|
""" parse testcase_template, replace all variables with bind value.
|
||||||
variables marker: ${variable}.
|
variables marker: ${variable}.
|
||||||
@param testcase_template
|
@param (dict) testcase_template
|
||||||
"request": {
|
{
|
||||||
"url": "http://127.0.0.1:5000/api/users/${uid}",
|
"request": {
|
||||||
"method": "POST",
|
"url": "http://127.0.0.1:5000/api/users/${uid}",
|
||||||
"headers": {
|
"method": "POST",
|
||||||
"Content-Type": "application/json",
|
"headers": {
|
||||||
"authorization": "${authorization}",
|
"Content-Type": "application/json",
|
||||||
"random": "${random}"
|
"authorization": "${authorization}",
|
||||||
|
"random": "${random}"
|
||||||
|
},
|
||||||
|
"body": "${data}"
|
||||||
},
|
},
|
||||||
"body": "${json}"
|
"response": {
|
||||||
},
|
"status_code": "${expected_status}"
|
||||||
"response": {
|
}
|
||||||
"status_code": "${expected_status}",
|
}
|
||||||
"headers": {
|
@return (dict) parsed testcase with bind values
|
||||||
"Content-Type": "application/json"
|
{
|
||||||
|
"request": {
|
||||||
|
"url": "http://127.0.0.1:5000/api/users/1000",
|
||||||
|
"method": "POST",
|
||||||
|
"headers": {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"authorization": "a83de0ff8d2e896dbd8efb81ba14e17d",
|
||||||
|
"random": "A2dEx"
|
||||||
|
},
|
||||||
|
"body": '{"name": "user", "password": "123456"}'
|
||||||
},
|
},
|
||||||
"body": {
|
"response": {
|
||||||
"success": True,
|
"status_code": 201
|
||||||
"msg": "user created successfully."
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user