zoukankan      html  css  js  c++  java
  • Jenkins(5)生成allure报告

    前言

    jenkins集成了allure插件,安装插件后运行pytest+allure的脚本即可在jenkins上查看allure报告了。
     

    allure安装

    在运行代码的服务器本机,我这里是用的docker容器,在容器内部安装allure-pytest
     

    先进docker容器

    docker exec -it -u root 容器id /bin/bash
    

    安装allure-pytest

    pip3 install allure-pytest
    

    详细安装教程参考这篇https://www.cnblogs.com/jiakecong/p/14292298.html
     

    Allure Jenkins Plugin插件安装

    docker容器内部准备好 Allure 的环境后,接着在jenkins上安装 Allure Jenkins Plugin 插件
    打开jenkins首页-系统管理-管理插件-可选插件,搜索:Allure

    安装完成后打开jenkins首页-全局工具配置-Allure Commandline, 安装 allure 命令行工具

    勾选自动安装,版本选择最新版2.13就可以了

     

    执行shell

    执行shell的地方改成运行allure的报告, 使用--alluredir 参数设置报告路径

    pytest --alluredir ./report
    


    ${WORKSPACE} 是jenkins的环境变量,表示当前的工作目录,更多的环境变量点上图的箭头位置:可用的环境变量列表
     

    如果想在报告中添加环境变量,还需加入以下命令

    cp environment.properties ${WORKSPACE}/report/environment.properties
    


    具体详情可参考这篇文章的最后一段https://www.cnblogs.com/jiakecong/p/14292298.html
     

    构建后操作

    添加构建后操作步骤-Allure Report

    Path地方写allure报告的地址,跟上面的执行xhsell地方生成的报告地址保持一致就可以了

     

    生成报告

    查看报告内容

  • 相关阅读:
    UVa532 Dungeon Master 三维迷宫
    6.4.2 走迷宫
    UVA 439 Knight Moves
    UVa784 Maze Exploration
    UVa657 The die is cast
    UVa572 Oil Deposits DFS求连通块
    UVa10562 Undraw the Trees
    UVa839 Not so Mobile
    327
    UVa699 The Falling Leaves
  • 原文地址:https://www.cnblogs.com/jiakecong/p/14303603.html
Copyright © 2011-2022 走看看