Pytest 系列(27)- allure 命令行参数

若是你还想从头学起Pytest,能够看看这个系列的文章哦!html

https://www.cnblogs.com/poloyy/category/1690628.htmljson

 

先看看 allure 命令的帮助文档

cmd 敲浏览器

allure -h

 

allure 命令的语法格式

allure [options] [command] [command options]

 

options 列表

  Options:
    --help 命令行帮助文档
    -q, --quiet
      切换至安静模式
      Default: false
    -v, --verbose
      切换至冗长模式
      Default: false
    --version
      版本信息
      Default: false

 

command 列表

  1. generate
  2. serve
  3. open
  4. plugin

这里只讲前三个经常使用的ui

 

generate 命令行参数

做用

生成 allure 的html 报告spa

 

语法格式

generate [options]  allure 结果目录

 

注:allure 结果目录就是运行 pytest 命令,--alluredir 跟的那个目录命令行

pytest -sq --alluredir= ./allure

 

命令选项

主要就是用  -c 、 -o  两个参数3d

 

open 命令行参数

做用

打开生成的 allure 报告,就是打开 generate 命令生成的报告code

 

语法格式

open [options] allure报告目录

 

注:allure 报告目录就是运行 allure generate 命令,-o 跟的那个目录htm

allure generate -o ./allure-report

 

命令选项

 

serve 命令行参数

做用

打开 allure 报告blog

 

语法格式

serve [options] allure 结果目录

 

注:allure 结果目录就是运行 pytest 命令,--alluredir 跟的那个目录

pytest -sq --alluredir= ./allure

 

命令选项

 

浏览器打开 allure 报告的两种方式

allure serve

标准写法

# 执行 pytest,指定 allure 结果目录
pytest -sq --alluredir=./allure

# 打开 allure 报告
allure serve ./allure

 

allure generate + allure open

 标准写法

# 执行 pytest,指定 allure 结果目录
pytest -sq --alluredir=./allure

# 生成 allure 的 html 报告
allure generate -c -o ./allure-report ./allure

# 打开 allure 报告
allure open ./allure-report

固然不写 -o 也能够

 

看看 allure-report 的目录结构

  • 这种方式的目录会好看不少,不仅是一堆 json 文件
  • 并且直接打开 index.html 也是能看到 allure 报告的
相关文章
相关标签/搜索