打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Allure测试框架,测试报告美化与定制



终端执行:

pytest test_allure_feature.py --allure-features="登录模块"  -vs  ---》执行具体feature

pytest test_allure_feature.py --allure-stories="登录成功"  -vs  ---执行具体stories

pytest test_allure_feature.py --allure-stories="登录失败" -vs

pytest test_allure_feature.py --allure-features="登录模块" -vs   --alluredir=./result1  --生成测试报告

allure serve ./result1   ---启动allure查看测试报告


代码1:

import pytest
import allure

@allure.feature("搜索模块")
class TestSearch():
def test_case1(self):
print("case1")
def test_case1(self):
print("case2")

@allure.feature("登录模块")
class TestLogin():
@allure.story("登录成功")
def test_login_sucess(self):
with allure.step("步骤1:打开应用"):
print("打开应用")

with allure.step("步骤2:进入登录页面"):
print("登录页面")

with allure.step("步骤3:输入用户名和密码"):
print("输入用户名和密码")

print("这是登录:测试用例,登录成功")

@allure.story("登录失败")
def test_login_sucess_a(self):
print("这是登录:测试用例,登录失败")




关联测试链接:

终端:

步骤1:pytest test_case.py --alluredir ./result2    --执行测试生成报告文件

步骤2:allure generate ./result2  ---报告文件生成html查看文件到默认文件allure-report里

步骤2:allure generate ./result2 -o report2  --报告文件生成html文件到指定文件report2里

代码2:

import allure

TEST_CASE_LINK='https://www.sekorm.com/'
@allure.testcase(TEST_CASE_LINK,"测试链接")
def test_with_testcase_link():
pass



终端执行:

pytest test_severity.py --allure-severities="normal"  -vs   --执行指定级别的测试用例

代码3

@allure.severity(allure.severity_level.TRIVIAL)
def test_with_trivial_severity():
pass

@allure.severity(allure.severity_level.NORMAL)
def test_with_normal_severity():
pass

@allure.severity(allure.severity_level.NORMAL)
class TestClassWithNormalSeverity(object):
def test_inside_the_normal_severity_test_class(self):
pass

@allure.severity(allure.severity_level.CRITICAL)
def test_inside_the_normal_severity_test_class_with_overriding_critical_severity(self):
pass

if
__name__ == '__main__':
pytest.main()
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Allure测试报告完整学习笔记
python单元测试之pytest的使用
pytest文档39-参数化(parametrize)结合allure.title()生成不同标题报告
测开新手学自动化:分享几点构建自动化测试框架经验
pytest框架快速入门-pytest运行时参数说明,pytest详解,pytest.ini详解
Python 单元测试框架:Pytest
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服