update doc string

This commit is contained in:
debugtalk
2017-06-28 11:43:23 +08:00
parent 12f20023b6
commit fbb7df5826
2 changed files with 42 additions and 20 deletions

View File

@@ -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": {
"url": "http://127.0.0.1:5000/api/users/1000",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"authorization": "a83de0ff8d2e896dbd8efb81ba14e17d",
"random": "A2dEx" "random": "A2dEx"
},
"body": '{"name": "user", "password": "123456"}'
},
"response": {
"status_code": 201
}
} }
""" """
self.pre_config(testcase) self.pre_config(testcase)

View File

@@ -14,7 +14,8 @@ 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": { "request": {
"url": "http://127.0.0.1:5000/api/users/${uid}", "url": "http://127.0.0.1:5000/api/users/${uid}",
"method": "POST", "method": "POST",
@@ -23,16 +24,26 @@ class TestcaseParser(object):
"authorization": "${authorization}", "authorization": "${authorization}",
"random": "${random}" "random": "${random}"
}, },
"body": "${json}" "body": "${data}"
}, },
"response": { "response": {
"status_code": "${expected_status}", "status_code": "${expected_status}"
}
}
@return (dict) parsed testcase with bind values
{
"request": {
"url": "http://127.0.0.1:5000/api/users/1000",
"method": "POST",
"headers": { "headers": {
"Content-Type": "application/json" "Content-Type": "application/json",
"authorization": "a83de0ff8d2e896dbd8efb81ba14e17d",
"random": "A2dEx"
}, },
"body": { "body": '{"name": "user", "password": "123456"}'
"success": True, },
"msg": "user created successfully." "response": {
"status_code": 201
} }
} }
""" """