Allure 特性 - 测试报告中添加附件 allure.attach

加文本

allure.attach("这是一段文本信息",name="文本显示")

加截图

@allure.feature("搜索模块")
class TestSearch():
    @allure.story("搜索成功")
    @allure.title("搜索用例1")
    def test_case_1(self):
        with allure.step("打开主界面"):
            print("step 1")
        with allure.step("打开登录界面"):

            print("step 2")
        with allure.step("输入信息"):
            print("step 3")
        with allure.step("点击登录"):
            print("step 4")
            allure.attach("E:\Life\20200818204615.jpg",    #使用allure.attach附上截图
                          name="截图",
                          attachment_type = allure.attachment_type.JPG,
                          extension=".jpg")

 

posted @ 2022-05-13 16:42  lms21  阅读(164)  评论(0编辑  收藏  举报