zoukankan      html  css  js  c++  java
  • Pytest 框架入门02--Allure测试报告

    Allure框架是一种灵活的轻量级多语言测试报告工具,它不仅能够以简洁的web报告形式显示已测试的内容,而且允许参与开发过程的每个人从测试的日常执行中提取最大限度的有用信息。

    在展开Allure详述前,先上一份测试报告,报告主要包含总览、类别、测试套件、图表、时间刻度、功能、包等7大部分,支持自定义诸多信息,包括附件添加、缺陷链接、案例链接、测试步骤、Epic、Feature、Story、Title、案例级别等,相当强大。
    环境配置:

    注:allure依赖java环境,1.8以上

    #安装pytest框架 pip install pytest #pytest基本报告,用于生成pytest-html报告 pip install pytest-html pip install allure-pytest pip install pytest-allure-adaptor(allure2可以不用安装这个插件了)



    下载Allure命令行工具:

    到github上下载Allure2 ,地址:https://github.com/allure-framework/allure2/releases
    下载完成后,解压放到C盘目录,并配置好环境变量
    如:C:allure-2.13.6in 添加到Path中
    在DOS中输入:

    allure --version 可查看对应的版本号。

    设置pytest.ini

     pytest.ini的介绍可参考:https://www.cnblogs.com/yoyoketang/p/9550648.html

    [pytest]
    addopts = -s  --html=./report/html/Test_Report.html --alluredir ./report/result        
    python_files = test_*.py
    python_classes = Test*
    python_functions = test_*
    • -s   打开详细信息
    • --html   是pytest-html生成目录和文件
    • --alluredir  是xml报告文件存放目录

    pytest  执行后会有在 ./report/result目录下生成一堆xml的报告文件,当不是我们最终想要的美观报告。

    在终端中输入:
    allure generate report/result  -o ./report/allure_html/ --clean
    
    然后再输入,打开美观报告:
    allure open ./report/allure_html/
  • 相关阅读:
    信息和熵
    【算法】欧几里得算法与青蛙约会oj
    【算法】并查集模板与练习
    Kaggle-房价预测
    【pytorch】pytorch-backward()的理解
    【pytorch】pytorch-LSTM
    【计算机网络】数据链路层总结
    【Code】numpy、pytorch实现全连接神经网络
    【MT】牛津的MT教程
    【计算机网络】物理层基础知识
  • 原文地址:https://www.cnblogs.com/yu2000/p/13864635.html
Copyright © 2011-2022 走看看