zoukankan      html  css  js  c++  java
  • httprunner 3.x学习15

    前言

    httprunner 3.x版本是基于 pytest 的,pytest 当然是可以支持 allure 报告了
    windows环境版本:

    • python 3.6版本
    • pytest 5.4.3版本
    • allure-pytest 2.8.6 最新版
    • allure 命令行 2.13.0 版本

    allure-pytest 环境准备

    使用 pip 安装 allure-pytest, 加上--index-url 国内下载源,下载会快一些

    pip install allure-pytest==2.8.6 --index-url https://pypi.douban.com/simple
    

    运行用例时候如果报错:AttributeError: module 'allure' has no attribute 'severity_level'
    这个是pytest-allure-adaptor 这个插件与 allure-pytest 不能共存,卸载掉 pytest-allure-adaptor

    pip uninstall pytest-allure-adaptor

    allure 命令行工具

    allure 是一个命令行工具,需要去github上下载https://github.com/allure-framework/allure2/releases
    注意不要下载2.13.10版本,这个版本有问题,很多同学使用这个版本会出现打开allure报告是空白页

    下载完成之后,解压到本地电脑

    把bin目录添加到环境变量Path下

    打开cmd窗口输入allure,出现内容说明allure命令行工具安装成功


    (需注意allure是依赖jdk环境的,电脑上要先安装jdk1.8版本)

    生成 allure 报告

    运行用例和生成allure报告是2个分开的步骤,运行用例生成json格式的报告文件,--alluredir 指定报告路径

    >hrun testcases/login_env.yml --alluredir ./allure_report
    

    也可以用pytest命令运行py文件

    >pytest testcases/login_userinfo_test.py --alluredir ./allure_report
    

    运行后会在当前目录生成allure_report文件夹,使用allure目录行工具启动服务

    >allure serve ./allure_report
    

    allure_report 文件夹内容

    生成的allure报告,用浏览器打开

  • 相关阅读:
    如何用正确的方法写出高质量软件的75条体会(转)
    使用javascript动态添加onclick事件,
    签名和重载
    C#文件后缀名详解
    配置SQL Server 2005 Express的身份验证方式,以及如何启用sa登录名。
    CSS选择符及优先级计算
    关于软件版本的解释
    数据结构形象解释
    CSS属性选择符
    [转载]Repeater三层嵌套
  • 原文地址:https://www.cnblogs.com/yoyoketang/p/14918924.html
Copyright © 2011-2022 走看看