Appium App自动化测试框架【二】

本文为博主原创,未经许可严禁转载。
本文链接:https://blog.csdn.net/zyooooxie/article/details/113873769

前面分享了 Appium App自动化测试框架【一】;现继续更新;

这是 App自动化测试的 category ,有兴趣 可以看看。

个人博客:https://blog.csdn.net/zyooooxie

需求

本期主要讲述:

在这里插入图片描述

生成测试报告

File:run_app.py


def run_main():
    # case_path_1 = os.path.join(case_path, 'test_test.py')

    py_list = ['-v', case_path, '--alluredir', allure_path, '--clean-alluredir', '--reruns', '1', '--reruns-delay', '5']
    pytest.main(py_list)

    # allure的environment.properties文件 会被清理掉
    with open(os.path.join(allure_path, 'environment.properties'), 'w') as f:
        w_str = 'Python.Version=3.6\nAuthor:xzc'
        f.write(w_str)

    allure_bat_path = r'C:\allure-2.7.0\bin\allure.bat'
    allure_cmd = "%s generate %s -o %s -c" % (allure_bat_path, allure_path, html_path)
    os.system(allure_cmd)

发送测试邮件【163邮箱】

@File:practice_email.py
使用的是 yagmail



def send_email():
    # qq邮箱、163邮箱 下面2行 通用;
    email = yagmail.SMTP(user=gl_acc, password=gl_pwd, host=gl_server, encoding='gbk')
    # email = yagmail.SMTP(user=gl_acc, password=gl_pwd, host=gl_server, encoding='gbk', smtp_ssl=True)

    subject = '重要通知:报告,随机码:{}'.format(random.randint(10000, 99999))
    content = ['Tester:{} (虚假) 已经完成测试'.format(f.name())]
    Log.info(subject)
    Log.info(content)

    # 最好不要使用相对路径的.
    file = [r'D:\0128postman.csv', r'D:\物业3.PNG', os.path.join(gl_par_path, '__init__.py'), os.path.join(gl_config_ini_path, 'config.ini')]

    email.send(to=gl_receiver, subject=subject, contents=content, attachments=file, cc=gl_cc)
    Log.info('邮件发送成功')
    email.close()

企微机器人发通知

File:practice_qw_robot.py


def send_msg(text, key='zyooooxie-zyooooxie-zyooooxie-zyooooxie-zyooooxie'):
    url = 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=' + key
    data_dict = {'msgtype': 'text', 'text': {'content': text}}
    res = requests.post(url=url, json=data_dict)
    assert res.json().get('errmsg') == 'ok'
    Log.info(f'{text}')
    print('企微通知完成')


Jenkins邮件通知【qq邮箱】

使用Email Extension Plugin 插件

在这里插入图片描述

Triggers 建议设置为 Always:

在这里插入图片描述

结果展示

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

这一篇主要的内容就这些;
因为我是为了练习,写个demo;

交流技术 欢迎+QQ 153132336 zy
个人博客 https://blog.csdn.net/zyooooxie

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值