:为dict -为list 一个-表示一个list[index]值 形式如下{[],[]}
teststeps: - name: login request: url: /login method: POST headers: Content-Type: application/json json: username: "15669910105" password: "a123456" extract: - token: content.token validate: - eq: ["status_code",200] - eq: ["content.data.username","15669910105"] - name: logout
with open(self.yaml, 'rb') as f:
self._data = yaml.safe_load(f) 读取为字典
{ 'teststeps': [ { 'name': 'login', 'request': { 'url': '/login', 'method': 'POST', 'headers': { 'Content-Type': 'application/json' }, 'json': { 'username': '15669910105', 'password': 'a123456' } }, 'extract': [ { 'token': 'content.token' } ], 'validate':[{'eq':['status_code',200]},{'eq':['content.data.username','15669910105']}] }, { 'name': 'logout' } ] }