定制Allure报告

定制Allure报告

自定义Logo图标

效果图

image

实现步骤

  1. 定位资源文件夹:首先,您需要定位到 allure/plugins/custom-logo-plugin/static 文件夹。这个文件夹通常包含Allure报告使用的静态资源,包括默认的Logo图像。
    image

  2. 放置新Logo:将您的新Logo图像文件放置到 allure/plugins/custom-logo-plugin/static 文件夹下。
    image

  3. 编辑styles.css文件:接下来,您需要编辑 styles.css 文件,以更新Logo的引用。(具体样式需要自行调试)

.side-nav__brand {
  background: url('您的新Logo文件名.png') no-repeat left center !important;
  background-size: 40px 40px !important;
  padding-left: 40px !important;
  margin-left: 10px;
}

.side-nav__brand span {
  display: none;
}

.side-nav__brand:after {
  content: "测试小罡"; /* 此处为示例,可根据需要替换为您的团队或项目名称 */
  margin-left: 20px;
}
  1. 定位配置文件:接下来,定位到 allure/config 文件夹。
    image

  2. 编辑allure.yml文件:在 allure.yml 文件中,您需要添加 -custom-logo-plugin 以启用自定义Logo插件。确保该文件中的插件列表包含此条目,如下所示:
    image

  3. 运行pytest:执行命令,生成Allure报告

pytest --alluredir [所要生成静态数据地址]
allure generate [静态数据地址] -o [本地地址]
posted @ 2025-01-06 10:00  测试小罡  阅读(123)  评论(0)    收藏  举报