24-pytest-allure命令行参数

简介: 24-pytest-allure命令行参数

查看帮助文档

  • allure  --help
  • 格式:allure [options] [command] [command options]
1. Usage: allure [options] [command] [command options]
2.   Options:
3.     --help
4.       Print commandline help.   帮助文档
5.     -q, --quiet   
6.       Switch on the quiet mode.   安静模式
7.       Default: false
8.     -v, --verbose            
9.       Switch on the verbose mode.    冗长模式
10.       Default: false
11.     --version
12.       Print commandline version.    版本
13.       Default: false
14.   Commands:
15.     generate      Generate the report
16.       Usage: generate [options] The directories with allure results
17.         Options:
18.           -c, --clean
19.             Clean Allure report directory before generating a new one.   删除allure报告生成的目录
20.             Default: false
21.           --config
22.             Allure commandline config path. If specified overrides values from
23.             --profile and --configDirectory.
24.           --configDirectory
25.             Allure commandline configurations directory. By default uses
26.             ALLURE_HOME directory.
27.           --profile
28.             Allure commandline configuration profile.
29.           -o, --report-dir, --output    allure报告目录
30.             The directory to generate Allure report into.
31.             Default: allure-report
32. 
33.     serve      Serve the report
34.       Usage: serve [options] The directories with allure results
35.         Options:
36.           --config
37.             Allure commandline config path. If specified overrides values from
38.             --profile and --configDirectory.
39.           --configDirectory
40.             Allure commandline configurations directory. By default uses
41.             ALLURE_HOME directory.
42.           -h, --host
43.             This host will be used to start web server for the report.
44.           -p, --port
45.             This port will be used to start web server for the report.
46.             Default: 0
47.           --profile
48.             Allure commandline configuration profile.
49. 
50. open      Open generated report
51.       Usage: open [options] The report directory
52.         Options:
53.           -h, --host
54.             This host will be used to start web server for the report.
55.           -p, --port
56.             This port will be used to start web server for the report.
57.             Default: 0
58. 
59.     plugin      Generate the report
60.       Usage: plugin [options]
61.         Options:
62.           --config
63.             Allure commandline config path. If specified overrides values from
64.             --profile and --configDirectory.
65.           --configDirectory
66.             Allure commandline configurations directory. By default uses
67.             ALLURE_HOME directory.
68.           --profile
69.             Allure commandline configuration profile.

generate 命令行参数

  • 作用:生成 allure 的html 报告
  • 格式:generate [options] allure报告目录

   命令行选项

  • -c, --clean : 删除allure之前生成的报告目录
  • -o, --report-dir, --output :生成allure报告目录,默认为allure-report

open 命令行参数

  • 作用:打开生成的 allure 报告,就是打开 generate 命令生成的报告
  • 格式:open [options] allure报告目录

  命令行选项

  • -h, --host : 启动报告的web服务器IP
  • -p, --port : 启动报告的web服务器端口

serve 命令行参数

  • 作用:启动 allure 服务,打开 allure 报告
  • 格式:serve [options]  allure报告目录

打开报告两种方式

  • 方式1:allure serve 报告目录
1. # -*- coding: utf-8 -*-
2. # @Time    : 2021/12/18
3. # @Author  : 大海
4. 
5. import os
6. 
7. 
8. def test_1():
9. print('这是case1')
10. 
11. 
12. def test_2():
13. print('这是case2')
14. 
15. 
16. if __name__ == '__main__':
17. # 运行pytest,--alluredir 指定报告结果目录为 allure-report
18.     os.system('pytest -sq test_43.py --alluredir=./allure-report')
19. # 打开allure报告 (目录与上面生成结果目录需一致)
20.     os.system('allure serve ./allure-report')
  • 方式2:allure generate + allure open 报告目录
1. # -*- coding: utf-8 -*-
2. # @Time    : 2021/12/18
3. # @Author  : 大海
4. 
5. import os
6. import time
7. 
8. 
9. def test_1():
10. print('这是case1')
11. 
12. 
13. def test_2():
14. print('这是case2')
15. 
16. 
17. if __name__ == '__main__':
18. # 运行pytest,--alluredir 指定报告结果目录为 allure
19.     os.system('pytest -sq test_44.py --alluredir=./allure')
20. # 生成HTML报告  -c 删除上次报告   -o 指定HTML报告路径   ./allure 是用户生成HTML报告的文件信息,是上一步骤生成的
21.     os.system('allure generate -c -o ./allure-report ./allure')
22. # 打开allure报告 (目录与上面生成HTML报告目录一致)
23.     os.system('allure open ./allure-report')


相关文章
|
编解码 算法 文件存储
浅谈动图文件格式 - GIF
介绍动图的文件格式,及其优劣
3995 0
浅谈动图文件格式 - GIF
|
SQL XML 关系型数据库
Mybatis-Plus通过SQL注入器实现真正的批量插入
Mybatis-Plus通过SQL注入器实现真正的批量插入
8703 0
Mybatis-Plus通过SQL注入器实现真正的批量插入
Jetpack Compose中ViewModel、Flow、Hilt、Coil的使用
Jetpack Compose中ViewModel、Flow、Hilt、Coil的使用
2186 0
Jetpack Compose中ViewModel、Flow、Hilt、Coil的使用
|
6月前
|
缓存 BI API
企业多模型 API 网关设计:路由、熔断、降级和计费
多模型网关的目标不是把架构画复杂,而是让企业在模型快速变化时有选择权。模型会继续升级,业务系统不应该跟着频繁重写。
776 0
|
7月前
|
存储 NoSQL 安全
Redis有1亿个Key,如何优雅地找出特定前缀的那10万条?
Redis是后端常用缓存,但线上禁用`KEYS`——它会阻塞单线程致服务假死。应改用渐进式`SCAN`命令安全遍历;更优解是建索引Set或分片存储。快不是万能的,稳才是生产环境的第一准则。(239字)
545 0
|
人工智能 搜索推荐 大数据
数字化转型三阶段:信息化、数字化、数智化分别代表着什么?
企业数字化转型分为信息化、数字化、数智化三个阶段,三者可并行推进。信息化实现业务数据化,提升管理效率;数字化打通信息孤岛,优化运营流程;数智化融合数据与智能技术,推动业务与管理智能化升级,助力企业构建新竞争优势,实现全面转型升级。
|
人工智能 自然语言处理 算法
DeepSeek大模型在客服系统中的应用场景解析
在数字化浪潮下,客户服务领域正经历深刻变革,AI技术成为提升服务效能与体验的关键。DeepSeek大模型凭借自然语言处理、语音交互及多模态技术,显著优化客服流程,提升用户满意度。它通过智能问答、多轮对话引导、多模态语音客服和情绪监测等功能,革新服务模式,实现高效应答与精准分析,推动人机协作,为企业和客户创造更大价值。
1322 5
|
缓存 网络协议 网络架构
以太网数据链路层、Ethernet_II帧格式、IEEE802.3帧格式,以太网的MAC地址的组成,ARP地址解析协议的工作原理,单播帧、组播帧、广播帧的区别
数据链路层,Ethernet_II帧格式、IEEE802.3帧格式,帧格式的区分以及链路层每种帧格式有什么作用,怎么区别分辨帧格式,以太网MAC地址的组成,ARP地址解析协议原理、什么是单播帧?什么是组播数据帧?什么是广播帧?...............
2383 0
以太网数据链路层、Ethernet_II帧格式、IEEE802.3帧格式,以太网的MAC地址的组成,ARP地址解析协议的工作原理,单播帧、组播帧、广播帧的区别
|
SQL 自然语言处理 Oracle
史上最详细的JDBC入门教程(初学者必看)
JDBC(Java DataBase Connectivity)是Java和数据库之间的一个桥梁,是一个规范而不是一个实现,能够执行SQL语句。它由一组用Java语言编写的类和接口组成。各种不同类型的数据库都有相应的实现,本文中的代码都是针对MySQL数据库实现的。
2339 0
史上最详细的JDBC入门教程(初学者必看)
|
安全 数据安全/隐私保护
西门子S7-200 SMART如何组态系统块,CPU、信号板和扩展模块的组态
上篇文章中我们学习了西门子S7-200 SMART查看符号名和绝对地址及符号表相关操作,本篇我们来介绍如何在编程软件STEP7-Micro/WIN SMART中组态系统块。系统块可提供对S7-200 SMART CPU、信号板和扩展模块的组态,下面我们将分别进行介绍。
西门子S7-200 SMART如何组态系统块,CPU、信号板和扩展模块的组态