allure commandline 命令行参数

发布时间 2023-12-10 17:48:33作者: hchengmx

本文地址:https://www.cnblogs.com/hchengmx/p/17892977.html

一、allure html 产生流程

Step 1. test文件运行后 产生 allure-results文件 (用来保存运行的结果)

产生allure html有两种方式

方法一:allure generate + allure open

  1. allure generate命令,将allure-results 生成 allure html,保存到指定目录
  2. 要打开的话,需要使用 allure open命令

方法二:allure server

allure server 提供与 allure generate + allure open一致的命令,区别在于生成的html文件保存在一个临时目录,通常为 C:\Users{login_user}\AppData\Local\Temp

二、语法格式

allure [options] [command] [command options]

generate

allure generate [option] ${allure_results目录} ${allure_reports目标目录}

命令参数

选项 描述
-c, --clean 是否删除 allure reports目录下的文件,默认false
--config 是否覆盖默认的 html配置,更改css格式,背景格式等
--configDirectory 与config配合使用,html配置文件路径
--profile 与config配合使用,html配置文件名
-o, --report-dir, --output 产生的html文件夹名,默认为 allure-report

主要用 -0, -c这两个参数。

open

用来打开 allure reports

选项 描述
-h, --host allure reports的host
-p, --port allure reports的端口,要是不指定,随机取一个没有在用的端口号

server

该命令相当于 allure generate + allure open,参数也与一致。

选项 描述
--config 是否覆盖默认的 html配置,更改css格式,背景格式等
--configDirectory 与config配合使用,html配置文件路径
-h, --host allure reports的host
-p, --port allure reports的端口,要是不指定,随机取一个没有在用的端口号
--profile 与config配合使用,html配置文件名

参考资料

Central Repository: io/qameta/allure/allure-commandline
allurereport.org
Allure Report Docs — How it works
allure2/allure-commandline/src/main/java/io/qameta/allure/CommandLine.java at master · allure-framework/allure2 · GitHub
Allure report graphic configuration | by Vitor Pimentel Barbosa | Quabity Ashuance | Medium
Pytest 系列(27)- allure 命令行参数 - 博客园