接口请求套路

*** Settings ***
Library requests
Resource resource.robot
Library Collections
Library RequestsLibrary
*** Test Cases ***
Test
  ${dict} Create Dictionary username liukaibin password 123456
  #输出变量
  log ${dict}
  #创建字典
  ${dict2} Create Dictionary Content-Type ${heard}
  log ${dict2}
  ${r} requests.post https://dev-ai-class-api-edu.codemao.cn/teacher/system/login headers=${dict2} json=${dict}
  log ${r.json()}

Test02
  Create Session url https://dev-ai-class-api-edu.codemao.cn
  #赋值变量
  ${yy} Set Variable {"username":"liukaibin","password":"123456"}
  #转换成json数组
  ${uu} To json ${yy}
  #创建字典
  ${dict2} Create Dictionary Content-Type ${heard}
  ${resp} Post Request url /teacher/system/login headers=${dict2} json=${uu}
  log ${resp.json()}

猜你喜欢

转载自www.cnblogs.com/kaibindirver/p/11804481.html
今日推荐