allure报告自定义logo和名称

前言


根据pytest框架,做自动化测试的时候,选择的是allure测试报告,这个报告是目前所有报告中功能最强大最好用的测试报告之一

我们在使用这个测试报告的时候,怎么样去把allure的logo和名称替换成自己公司或者自己的logo呢?

操作


步骤一: 更换图片

找到本地安装的allure路径 我的路径为:D:softwareLibsite-packagesallure-2.7.0pluginscustom-logo-pluginstatic
然后将图片放至这个文件夹中,名字起名为allure_logo.jpg

步骤二:修改取值文件

D:softwareLibsite-packagesallure-2.7.0pluginscustom-logo-pluginstatic  继续在这个路径下找到里面的“styles.css” 文件
以文本格式打开进行编辑,将原本的内容删除掉,然后将下面这些内容复制进去,下面content 是定制的文案,可以进行更改成你自定义的

.side-nav__brand {
  background: url('allure_logo.jpg') no-repeat left center !important;
  margin-left: 10px;
  height: 50px;
  background-size: contain !important;
}


.side-nav__brand span{
  display: none;
}
.side-nav__brand:after{
  content: "Z天赐";
  margin-left: 20px;
}

 步骤三:到allure安装目录下allure-2.7.0config下面的allure.yml文件,打开它,在最末尾加一行内容:- custom-logo-plugin,如下图:

成果


这时候在运行你的代码,再看看生成的报告

原文地址:https://www.cnblogs.com/ztcbug/p/15550490.html