> 文章列表 > 接口自动化-Requests接口自动化

接口自动化-Requests接口自动化

接口自动化-Requests接口自动化

接口关联三个层次:

  1. 通过类变量保存中间变量实现接口关联
  2. 通过单独的文件保存中间变量实现接口关联
  3. 极限封装成零代码的方式实现接口关联

接口关联两种方式:

  1. 正则提取实现接口关联
    re.seach()通过正则匹配一个值,通过下表[1]取值,没有匹配到返回None
    re.findall()通过正则匹配多个值,返回list,通过下标取值,没有匹配到返回None
  2. JsonPath提取实现接口关联
    jsonpath.jsonpath()返回一个列表,通过下标取值,没有返回None

pytest    本身

pytest-html   生成html报告

pytest-xdist  多线程执行

pytest-ordering    控制用例的执行顺序

pytest-rerunfailures   失败用例重跑

pytest-base-url     基础路径

pytest-pytest  生成allure报告

岩板大全