培训首页  >  软件测试新闻  >  Python代码

Python代码

[2017-06-30 16:46:54] 浏览量:72 来源:

北京尚脑互联软件测试培训中心

  def parse(self, testcase_template):

  """ parse testcase_template, replace all variables with bind value.

  variables marker: ${variable}.

  @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}"

  },

  "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"}'

  },

  "response": {

  "status_code": 201

  }

  }

  """

  return self.substitute(testcase_template)

  请联系网站,了解详细的优惠课程信息~

  优质、便捷、省心


文中图片素材来源网络,如有侵权请联系删除

网上报名

热门信息

温馨提示