-
Allure介绍
-
Allure环境搭建
- pip install pytest==4.5.0 --index-url https://pypi.douban.com/simple
- pip install allure-pytest==2.8.6 --index-url https://pypi.douban.com/simple
- allure是一个命令行工具,需要去github上下载最新版https://github.com/allure-framework/allure2/releases
-
Allure使用
- 1、allure用例描述
- 1、allure用例描述
#代码示例:
import pytest,time
import allure
@allure.feature('demo模块')
@allure.story('登录功能')
class Test_class:
@allure.title('正常登录')
@allure.severity('P1级用例')
@allure.testcase('https://www.cnblogs.com/hls-code/p/15166015.html')
def test_001(self):
a = 'hello'
b = 'hello world'
time.sleep(1)
assert a != b
print('测试用例--001')
@allure.title('异常登录')
@allure.description('密码错误')
@allure.testcase('http://t.zoukankan.com/liudinglong-p-13056109.html')
def test_002(self):
a = 1
b = 2
assert a+b == 3
time.sleep(1)
print('测试用例--002')
@allure.feature('demo模块')
@allure.testcase('https://www.baodu.com')
@allure.issue('bug链接')
@pytest.mark.xfail
def test_003():
a = 'hello'
b = 'hello world'
time.sleep(1)
assert a in b
print('测试用例--003')
-
2、生成报告:pytest --alluredir ./report/allure_raw
-
3、运行报告:
- 3.1:allure serve report/allure_raw
- 查看报告:
- 查看报告:
- 3.1:allure serve report/allure_raw
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。