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

    前言

    HttpRunner 3.x版可以使用所有的 pytest 插件,包括测试报告插件,像的 pytest-html 和 allure-pytest 。

    pytest-html

    httprunner 安装的时候,会自动安装 pytest 和 pytest-html 插件,对应的版本号是

    • pytest 5.4.3
    • pytest-html 2.1.1
    C:Usersdell>pip show pytest
    Name: pytest
    Version: 5.4.3
    
    C:Usersdell>pip show pytest-html
    Name: pytest-html
    Version: 2.1.1
    

    hrun 生成报告

    hrun 命令生成报告的时候,带上 --html 指定报告路径

    >hrun testcases/login_userinfo_test.py --html=./reports/result.html
    

    --html 参数生成的报告,css文件是单独分开的,不方便查看,可以加上--self-contained-html参数让css文件集成到html上

    >hrun testcases/login_userinfo_test.py --html=./reports/result.html --self-contained-html
    

    运行结果

    查看html报告

    pytest 生成报告

    用 hrun 运行生成的报告会出现一大堆的报错: OSError: [WinError 6] 句柄无效。并且无法显示 request 和 response 内容。
    hrun 执行pytest用例还不太完善,尽量用pytest去执行py脚本

    >pytest testcases/login_userinfo_test.py --html=./reports/result.html --self-contained-html
    

    执行后查看报告

    allure 报告

    httprunner3 也可以支持 allure 插件,需 pip 安装

    > pip install allure-pytest
    

    相关教程看这篇https://www.cnblogs.com/yoyoketang/p/12004145.html

  • 相关阅读:
    java类的继承
    Java数组运算
    Eclipse问题提示
    oracle的insert的时候&符号如何插入(转义)
    修改数据库用户名--CMD环境执行有效
    java环境变量设置
    当前时间时间戳以及10分钟后的时间戳
    复选框事件
    分享到
    多物体运动
  • 原文地址:https://www.cnblogs.com/yoyoketang/p/14890723.html
Copyright © 2011-2022 走看看