zoukankan      html  css  js  c++  java
  • ui自动化框架出测试报告

    1.防止jenkis集成报错

    import subprocess

    2.subprocess.call  shell=true 会有延迟时间让用例一条一条跑,手动点击停止

    防止python脚本执行完之后,jenkis没有生成测试报告

    专门负责出测试报告的模块  allure 模块 pytest专门出测试用例 

    1.解压文件
    2.将解压bin 目录放到系统环境变量path 下
    3.allure --version cmd输入
    4.python 安装 pip install allure-pytest

    5.在每一个test开头的用例中添加描述


    @allure.story('登录')#模块
    @allure.title('反案例登录')
    @allure.description('第二个案例')#描述
    也可以添加地址 一个指向bug 一个指向测试用例
    6.run调用的优化
    import pytest
    import time
    import subprocess #引入模块


    if __name__ == '__main__':
    report_time = time.strftime('%Y%m%d_%H%M%S', time.localtime(time.time()))#转成时间戳
    pytest.main(['-s', './cases/',f'--alluredir=report/{report_time}/json/'])
    #自动调用
    import pytest
    import time
    import subprocess

    if __name__ == '__main__':
    report_time = time.strftime('%Y%m%d_%H%M%S', time.localtime(time.time()))
    pytest.main(['-s', './cases/',f'--alluredir=report/{report_time}/json/'])
    subprocess.call(
    f'G://a-刘泽老师视频/ui自动化/ui自动化/出测试报告/allure-commandline-2.13.3/allure-2.13.3/bin/allure generate report/{report_time}/json/ -o report/{report_time}/html/',
    shell=True)
    allure generate report/{report_time}/json/ -o report/{report_time}/html/ 实际实在cmd窗口里跑,这样不智能了所以引入了
    subprocess.call 就是引入shell脚本的命令
  • 相关阅读:
    java学习笔记(二)分布式框架Dubbo+zookeeper搭建
    java学习笔记(一) 服务器的认识
    用slf4j+logback实现多功能日志解决方案 --- 转
    9.3.2 The force and release procedural statements
    3.7.4 Tri0 and tri1 nets
    9.3.1 The assign and deassign procedural statements
    10. Tasks and functions
    6.1.2 The continuous assignment statement
    df 查看磁盘使用情况
    信息学竞赛知识点整理
  • 原文地址:https://www.cnblogs.com/weilemeizi/p/15202202.html
Copyright © 2011-2022 走看看