接口請求套路

 

 

*** 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

相關文章
相關標籤/搜索