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脚本的命令
  • 相关阅读:
    k-d tree
    K近邻算法-KNN
    ORB特征提取与匹配
    ZeroMQ一个更小、更快、更简单的智能传输层协议
    ROS导航之参数配置和自适应蒙特卡罗定位
    cmake实战第二篇:让我们的代码更像个工程
    gcc/g++实战之动态链接库与静态链接库编写
    gcc/g++ 实战之编译的四个过程
    通过 LPeg 介绍解析表达式语法(Parsing Expression Grammars)
    Forth 语言概要
  • 原文地址:https://www.cnblogs.com/weilemeizi/p/15202202.html
Copyright © 2011-2022 走看看