RF接口测试DEMO2

2017-11-01  本文已影响32人  心无旁骛_

Get Requests with Url Parameters

使用URL参数获取请求。

预习知识:

Requests 传递 URL 参数

>>>payload{'key1':'value1','key2':'value2'}

>>>r=requests.get("http://httpbin.org/get",params=payload)

>>>print(r.url)

http://httpbin.org/get?key2=value2&key1=value1

脚本截图

Get Requests with Url Parameters

[Tags]  get

Create Session  httpbin    http://httpbin.org

&{params}=  Create Dictionary  key=value    key2=value2

${resp}=    Get Request  httpbin  /get    params=${params}    

#http://httpbin.org/get?key=value&key2=value2

Should Be Equal As Strings  ${resp.status_code}  200

${jsondata}=  To Json  ${resp.content}

Should be Equal    ${jsondata['args']}    ${params}

上一篇 下一篇

猜你喜欢

热点阅读