我正在学习机器人框架,API 自动化:
*** Settings ***
Library RequestsLibrary
Library Collections
Library String
*** Variables ***
${headers} Create Dictionary Authorization Bearer abcde
*** Test Cases ***
Make a simple REST API call
[Tags] API
Create Session my_json http://localhost:3000
Log ${headers}
${response} = Get Request my_json /posts headers=${headers}
Log ${response}
# Check the Response status
Should Be Equal As Strings ${response.status_code} 403
# ${response} = Get Request my_json /posts
${json} = Set Variable ${response.json()}
Log ${json}
Log len(${json})
Should Be Equal As Strings ${json['name']} rajesh
我在 log.html 中收到此错误
文档:对使用给定的会话对象发送 GET 请求 alias
开始/结束/经过:20181209 18:43:04.159 / 20181209 18:43:04.175 / 00:00:00.016 18:43:04.175 失败 AttributeError: 'str' 对象没有属性 'str'
慕虎7371278
BIG阳
一只萌萌小番薯
相关分类