0
点赞
收藏
分享

微信扫一扫

pytest + yaml 框架 -38.企业微信机器人通知

前言

v1.3.2版本 支持企业微信机器人发送报告通知了。

pip install pytest-yaml-yoyo

获取企业微信机器人token

企业机器人相关接口可以看官方文档https://developer.work.weixin.qq.com/document/path/91770 创建群聊机器人

pytest + yaml 框架 -38.企业微信机器人通知_关系映射


pytest + yaml 框架 -38.企业微信机器人通知_微信_02


pytest + yaml 框架 -38.企业微信机器人通知_pytest+yaml_03


pytest + yaml 框架 -38.企业微信机器人通知_关系映射_04


pytest + yaml 框架 -38.企业微信机器人通知_关系映射_05

获取到webhook访问地址https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=********************* key= 后面的这串就是我们要的token

配置企业微信机器人通知

在运行环境配置中加一个WE_COM的配置即可

# 配置企业微信群通知
    WE_COM = {
        "token": "******复制前面得到的token*********",
    }

参照pytest + yaml 框架 -13.多环境配置切换

class Config:
    """多套环境的公共配置"""
    version = "v1.0"

    # 配置企业微信群通知
    WE_COM = {
        "token": "******复制前面得到的token*********",
    }


class TestConfig(Config):
    """测试环境"""
    BASE_URL = 'http://192.168.1.1:8000'


class UatConfig(Config):
    """联调环境"""
    BASE_URL = 'http://192.168.1.3:8080'



# 环境关系映射,方便切换多环境配置
env = {
    "test": TestConfig,
    "uat": UatConfig
}

在pytest.ini 中配置

[pytest]


env = test

执行用例就会自动触发企业微信机器人

pytest + yaml 框架 -38.企业微信机器人通知_关系映射_06



举报

相关推荐

0 条评论