【RF】接口自动化demo
*** Settings ***
Library DateTime
Library Selenium2Library
Library RequestsLibrary
*** Test Cases ***
接口自动化
${headers} Create Dictionary Content-Type=application/x-www-form-urlencoded
Create Session base_url https://novel.hctestedu.com/
${data} Create Dictionary username=18652030268 password=1234567890
${response} Post Request base_url /user/login data=${data} headers=${headers}
${response_json} Set Variable ${response.json()}
log ${response.json()}
${headers1} Create Dictionary Cookie=Authorization=${response_json}[data][token] Content-Type=application/x-www-form-urlencoded
${data1} Create Dictionary bookId=199 preContentId=945
${response1} Post Request base_url user/addToBookShelf data=${data1} headers=${headers1}
${response1_json} Set Variable ${response1.json()}
log ${response1.json()}
${headers2} Create Dictionary Cookie=Authorization=${response_json}[data][token]
${data2} Create Dictionary curr=1 limit=10
${response2} Get Request base_url user/listBookShelfByPage data=${data2} headers=${headers1}
${response2_json} Set Variable ${response2.json()}
log ${response2.json()}
Should Be True ${response2.json()}[data][list][0][bookId]==199
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义