pytest 接口自动化测试训练营

pytest PPT

https://pdf.ceshiren.com/pub_class/pytest_训练营ppt/#/47

allure PPT

https://pdf.ceshiren.com/pub_class/allure_训练营ppt/#/

直播课 PPT

https://pdf.ceshiren.com/pub_class/0908接口训练营/#/25

参考代码:

@allure.feature("企业微信部门管理")
class TestPartManager:
  @allure.story("获取token")
  def test_get_token(self):
    corpid = "你的 corpid"
    corpsecret = "你的 corpsecret"
    url = f"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={corpid}&corpsecret={corpsecret}"
    result = requests.get(url)
    print(result.json().get("access_token"))

  @allure.story("添加部门")
  def test_add_part(self):
    corpid = "你的 corpid"
    corpsecret = "你的 corpsecret"
    url = f"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={corpid}&corpsecret={corpsecret}"
    result = requests.get(url)
    acess_token = result.json().get("access_token")

    add_part_url = f"https://qyapi.weixin.qq.com/cgi-bin/department/create?access_token={acess_token}"
    add_part_body = {
        "name": "霍格沃兹测试学社2",
        "parentid": 1,
      }
    result1 = requests.post(add_part_url,json=add_part_body)
    errcode = result1.json().get("errcode")
    assert 0 == errcode

获取 corpid 与 corpsecret 方式

2021.09.09 -开营-pytest_allure 接口训练营-获取token.pdf (60.4 KB)

加入学习交流群

  • 欢迎学习由霍格沃兹测试学院出品的测试开发技术系列课,关于本次课程,你在学习中遇到任何问题,可以添加小助手,加入微信技术交流群交流。
    pytest训练营入群
关闭