接口请求套路

 

 

*** 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()} 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()}api

相关文章
相关标签/搜索