Robot Framework 发送接口示例

安装robotframework、robotframework-requests

pip install robotframework
pip install robotframework-requests

编写脚本httpbin.robot

*** Settings ***
Documentation    Suite description
Library  RequestsLibrary


*** Test Cases ***
Test title
    &{headers}=  create dictionary  Content-Type=application/x-www-form-urlencoded
    log  ${headers}
    create session  httpbin  https://httpbin.org     headers=${headers}
    &{data}=  create dictionary  a=1  b=2  c=3
    ${resp}   post request  httpbin  /post  data=${data}
    log  ${resp.status_code}

命令行运行

robot httpbin.robot 
原文地址:https://www.cnblogs.com/superhin/p/13294425.html