# -*- coding: utf-8 -*-
# @Time : 2023/7/10 15:06
# @Author : yanfa
# @user : yanfa
# @File : test_allure_05_for_add_description.py
# @remark: allure 添加用例描述
""""""
import allure
"""一、allure 用例描述
應(yīng)用場景:
allure支持往測試報告中對測試用例添加詳細(xì)的描述語,用于描述用例詳情,對應(yīng)報告詳情中Description字段。
4種添加方式:
1)字符串描述:
@allure.description("xx")
2)html文本描述
@allure.description_html("xx代碼塊")
3)直接在用例方法內(nèi)編寫文檔注釋
def test_xx:
""""""
pass
4)用例代碼內(nèi)部動態(tài)添加描述
@allure.description("老"):
def test_xx():
pass
allure.dynamic.description("新"):
allure.dynamic.description_html("新"):
"""
@allure.description("""這是第一種方式-裝飾器文本描述""")
def test_description_01():
assert 2 == 2
@allure.description_html("""<html>
<head>
<title>這是第二種方式-html注釋</title>
</head>
<body>
<h1>這是第二種方式-html注釋</h1>
</body>
</html>""")
def test_description_02():
assert 2 == 2
def test_description_03():
"""
這是第三種方式-測試方法內(nèi)加注釋
"""
assert 2 == 2
@allure.description("這是第一種方式文本描述-老")
def test_description_04():
assert 2 == 2
allure.dynamic.description("這是第一種方式文本描述-新")
@allure.description_html("""<html>
<head>
<title>這是第二種html注釋-老</title>
</head>
<body>
<h1>這是第二種html注釋-老</h1>
</body>
</html>""")
def test_description_05():
assert 2 == 2
allure.dynamic.description_html("""<html>
<head>
<title>這是第二種html注釋-新</title>
</head>
<body>
<h1>這是第二種html注釋-新</h1>
</body>
</html>""")
python接口自動化-allure2-添加用例描述
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。