python之allure报告

import pytest
import allure
class Test_all():
    @allure.step(title="allure通过注解方式完成内容的展示,setp表示测试步骤1...")
    def test_setup(self):
        print("我就是打酱油的setup")
 
    @allure.step(title="run就是一个正常的方法.")
    def test_run(self):
        allure.attach("自定义描述1""描述内容,自定义")
        print("我要运行")
        assert True
 
    def test_skip(self):
        print("我要跳过")
 
    @allure.severity(allure.severity_level.BLOCKER)  #严重级别
    @allure.testcase("http://www.baidu.com/""测试用例的地址")
    @allure.issue("http://music.migu.cn/v3/music/player/audio""点击可跳转到bug地址")
    def test_error(self):
        with allure.attach("自定义描述1""我需要让他进行错误"):
            print("我错误了")
            assert False
 

运行命令方式

使用cmd运行,或者使用pycharm运行都是可以的,以下我使用pycharm的环境运行

1.进入运行项目的目录下 执行命令 pytest 运行的py文件

2.上图有一个F就是表示有错误日志,执行完后,就会直接打印到了屏幕上

3.我们使用命令生成报告

 4.在我进入的目录中就可以看到生成了文件

原文地址:https://www.cnblogs.com/zixiaxianzi-ufoowen/p/14093282.html