def link(url, link_type=LinkType.LINK, name=None): return safely(plugin_manager.hook.decorate_as_link(url=url, link_type=link_type, name=name)) def issue(url, name=None): return link(url, link_type=LinkType.ISSUE, name=name) def testcase(url, name=None): return link(url, link_type=LinkType.TEST_CASE, name=name)
示例代碼以下:html
# -*- coding: utf-8 -*- # @Time : 2020/12/12 15:49 # @Author : longrong.lang # @FileName: test_allurelink.py # @Software: PyCharm # @Cnblogs :https://www.cnblogs.com/longronglang import allure from allure_commons.types import LinkType @allure.issue("https://v.youku.com/v_show/id_XNDk5MDQyODI1Ng==.html", "youku 三個金幣") def test_issue(): pass @allure.link("https://www.baidu.com/", link_type=LinkType.LINK, name="baidu") def test_link(): pass @allure.testcase("https://www.cnblogs.com/longronglang/", "久曲健博客園") def test_testCase(): pass
運行結果,查看allure報告python
test_issue
測試
test_link
url
test_testCase
code
三個裝飾器的做用是同樣的,都是超連接跳轉,至於如何使用,請視本身狀況,調整htm