转:https://www.cnblogs.com/canglongdao/p/13414829.html

前言

pytest+allure是最完美的结合了,关于allure的使用,本篇做了一个总结。

allure报告可以包含很多详细的信息描述测试用例,包括epic、feature、story、title、issue、testcase、severity等

allure用例描述

测试案例

pytest结合allure测试用例

执行用例
1、cd到test_a.py的目录
2、pytest –alluredir ./report/a  

生成报告:
allure serve ./report/a
  
报告展示内容

命令行参数

pytest运行用例的时候可以加上allure标记用例的参数
–allure-severities=SEVERITIES_SET
Comma-separated list of severity names. Tests only
with these severities will be run. Possible values
are: blocker, critical, normal, minor, trivial.
–allure-epics=EPICS_SET
Comma-separated list of epic names. Run tests that
have at least one of the specified feature labels.
–allure-features=FEATURES_SET
Comma-separated list of feature names. Run tests that
have at least one of the specified feature labels.
–allure-stories=STORIES_SET
Comma-separated list of story names. Run tests that
have at least one of the specified story labels.
–allure-link-pattern=LINK_TYPE:LINK_PATTERN
Url pattern for link type. Allows short links in test,
like \’issue-1\’. Text will be formatted to full url
with python str.format(). 

选择运行你要执行epic的用例

  pytest --alluredir ./report/allure --allure-epics=epic对大Story的一个描述性标签

选择运行你要执行features的用例

  pytest --alluredir ./report/allure --allure-features=模块2

选择运行你要执行features的用例

  pytest --alluredir ./report/allure --allure-stories="用户故事:1"

关于allure的使用基本上就是这些了

版权声明:本文为tkliu原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/tkliu/p/14212613.html