解压zip包,进入allure/bin下,该文件下两个文件allure.bat(windows)和 allure(linux),执行pytest命令用。
使用稳定版,最新版默认没有bin目录,为什么我也不知道~
添加环境变量将bin目录加到环境变量。运行allure --version查看是否可用。
安装第三方库pip install allure-pytest。 allure-pytest 暂时只安装这一个就行,pytest 会被当做依赖安装好。
执行脚本并生产报告数据任意创建一个项目,在项目下命令行执行 pytest --alluredir report。
执行pytest 生产allure测试结果数据,存放到report下。
此时在项目下会多一个report 文件夹。
生产测试报告项目根目录下执行 allure generate --clean report -o html。执行成功返回:Report successfully generated to html
执行allure生成报告,数据目录是 report ,报告生成 在html 目录
打开报告项目根目录下执行allure open html。浏览器会默认打开报告。
Starting web server... 2020-03-18 23:35:41.157:INFO::main: Logging initialized @209ms to org.eclipse.jetty.util.log.StdErrLog Server started at <http://10.0.63.105:53297/>. Press <Ctrl+C> to exitallure 命令Usage: allure [options] [command] [command options] Options: --help Print commandline help. -q, --quiet Switch on the quiet mode. Default: false -v, --verbose Switch on the verbose mode. Default: false --version Print commandline version. Default: false Commands: generate 生成报告 Usage: generate [options] The directories with allure results Options: -c, --clean Clean Allure report directory before generating a new one. Default: false --config Allure commandline config path. If specified overrides values from --profile and --configDirectory. --configDirectory Allure commandline configurations directory. By default uses ALLURE_HOME directory. --profile Allure commandline configuration profile. -o, --report-dir, --output The directory to generate Allure report into. Default: allure-report serve Serve the report Usage: serve [options] The directories with allure results Options: --config Allure commandline config path. If specified overrides values from --profile and --configDirectory. --configDirectory Allure commandline configurations directory. By default uses ALLURE_HOME directory. -h, --host This host will be used to start web server for the report. -p, --port This port will be used to start web server for the report. Default: 0 --profile Allure commandline configuration profile. open Open generated report Usage: open [options] The report directory Options: -h, --host This host will be used to start web server for the report. -p, --port This port will be used to start web server for the report. Default: 0 plugin Generate the report Usage: plugin [options] Options: --config Allure commandline config path. If specified overrides values from --profile and --configDirectory. --configDirectory Allure commandline configurations directory. By default uses ALLURE_HOME directory. --profile Allure commandline configuration pr安装过程很简单。下载解压,添加环境变量。linux和window没什么区别。
之后分享报告使用过程中的心得和技巧~
---来自腾讯云社区的---Criss@陈磊
微信扫一扫打赏
支付宝扫一扫打赏