Robotframework 如何将参数发布到服务器?
我想使用“机器人框架”向服务器发送一些参数 我编写的代码如下所示Robotframework 如何将参数发布到服务器?,robotframework,Robotframework,我想使用“机器人框架”向服务器发送一些参数 我编写的代码如下所示 *** Setting *** Library REST myserver.com *** Variable *** &dict = auth_key=****** *** Test Cases *** Send Auth Key and Get Access Token. POST /auth ${dict} Integer response status 200
*** Setting ***
Library REST myserver.com
*** Variable ***
&dict = auth_key=******
*** Test Cases ***
Send Auth Key and Get Access Token.
POST /auth ${dict}
Integer response status 200
但服务器没有收到任何参数
如何更正代码
谢谢。如果您正在使用REST库,它将不再更新。我建议使用请求库,它构建在python中的请求库之上 下面是一个带有Json数据的Post请求示例
Post Requests with Json Data
[Tags] post
Create Session httpbin http://httpbin.org
&{data}= Create Dictionary latitude=30.496346 longitude=-87.640356
${resp}= Post Request httpbin /post json=${data}
Should Be Equal As Strings ${resp.status_code} 200
${jsondata}= To Json ${resp.content}
Should Be Equal ${jsondata['json']} ${data}
将测试用例更改为:
*** Settings ***
Library RequestsLibrary
*** Test Cases ***
Send Auth Key and Get Access Token.
Create Session Gateway https://URLHERE
&{dict} = Create Dictionary auth_key=******
${resp}= Post Request Gateway /auth json=${dict}
Should Be Equal As Strings ${resp.status_code} 200
这是什么图书馆?它看起来像是一个——它被遗弃了很久。如果是这样的话,你最好选择一些更受欢迎的东西,比如这个:OK。我将使用RequestsLibrary。谢谢你的回答。