RobotFramework下的http接口自动化Get Response Status 关键字的使用

时间:2023-03-09 04:42:27
RobotFramework下的http接口自动化Get Response Status 关键字的使用

Get Response Status 关键字用来获取http请求返回的http状态码。

示例1:访问苏宁易购网站上的http推荐接口,使用Get Response Status 关键字来获取返回的http 状态码

Create Http Context       tuijian.suning.com  scheme=http

GET       /recommend-portal/recommendv2/biz.jsonp?callback=showFinal&parameter=%E7%AC%94%E8%AE%B0%E6%9C%AC&sceneIds=2-1&count=5&cityId=9173&price=&brandCode=

${body}  Get Response Status

log    ${body}

RobotFramework下的http接口自动化Get Response Status 关键字的使用

执行结果:

RobotFramework下的http接口自动化Get Response Status 关键字的使用

从获取到的结果看,我们获取大状态码为200 OK。

【原文归作者所有,欢迎转载,但是保留版权】