From fbb7df5826bcf5b6c76ec66736e2fedd7cab0edb Mon Sep 17 00:00:00 2001 From: debugtalk Date: Wed, 28 Jun 2017 11:43:23 +0800 Subject: [PATCH] update doc string --- ate/runner.py | 17 ++++++++++++++--- ate/testcase.py | 45 ++++++++++++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/ate/runner.py b/ate/runner.py index ea8650a1..e655200e 100644 --- a/ate/runner.py +++ b/ate/runner.py @@ -54,10 +54,21 @@ class TestRunner(object): "request": {}, "response": {} } - @return (dict) variables binds mapping + @return (dict) parsed testcase with bind values { - "TOKEN": "debugtalk", - "random": "A2dEx" + "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"}' + }, + "response": { + "status_code": 201 + } } """ self.pre_config(testcase) diff --git a/ate/testcase.py b/ate/testcase.py index 0fa22929..41d90e01 100644 --- a/ate/testcase.py +++ b/ate/testcase.py @@ -14,25 +14,36 @@ class TestcaseParser(object): def parse(self, testcase_template): """ parse testcase_template, replace all variables with bind value. variables marker: ${variable}. - @param testcase_template - "request": { - "url": "http://127.0.0.1:5000/api/users/${uid}", - "method": "POST", - "headers": { - "Content-Type": "application/json", - "authorization": "${authorization}", - "random": "${random}" + @param (dict) testcase_template + { + "request": { + "url": "http://127.0.0.1:5000/api/users/${uid}", + "method": "POST", + "headers": { + "Content-Type": "application/json", + "authorization": "${authorization}", + "random": "${random}" + }, + "body": "${data}" }, - "body": "${json}" - }, - "response": { - "status_code": "${expected_status}", - "headers": { - "Content-Type": "application/json" + "response": { + "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": { + "Content-Type": "application/json", + "authorization": "a83de0ff8d2e896dbd8efb81ba14e17d", + "random": "A2dEx" + }, + "body": '{"name": "user", "password": "123456"}' }, - "body": { - "success": True, - "msg": "user created successfully." + "response": { + "status_code": 201 } } """