如果你还想从头学起Pytest,可以看看这个系列的文章哦!
https://www.cnblogs.com/poloyy/category/1690628.html
前言
平时写测试用例也会划分优先级
同样,allure 也提供用例级别,在 allure 报告可以清晰看到不同级别用例的缺陷数量
用例等级介绍 allure 提供的枚举类
等级介绍
blocker:阻塞缺陷(功能未实现,无法下一步)
critical:严重缺陷(功能点缺失)
normal: 一般缺陷(边界情况,格式错误)
minor:次要缺陷(界面错误与ui需求不符)
trivial: 轻微缺陷(必须项无提示,或者提示不规范)
实际栗子 测试代码
#!/usr/bin/env python # -*- coding: utf-8 -*- """ __title__ = __Time__ = 2020-04-19 14:50 __Author__ = 小菠萝测试笔记 __Blog__ = https://www.cnblogs.com/poloyy/ """ import allure def test_with_no_severity_label(): pass @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): """ 测试类优先级 normal;看看测试用例是否会自动继承优先级 """ print() @allure.severity(allure.severity_level.CRITICAL) def test_inside_the_normal_severity_test_class_with_overriding_critical_severity(self): """ 测试类优先级 normal 测试用例优先级 critical """ pass @allure.severity("normal") def test_case_1(): """ normal 级别测试用例 """ print("test case 11111111") @allure.severity("critical") def test_case_2(): """ critical 级别测试用例 """ print("test case 222222222") @allure.severity("blocker") def test_case_3(): """ blocker 级别测试用例 """ print("test case 4444444") @allure.severity("minor") def test_case_4(): """ minor 级别测试用例 """ print("test case 11111111") def test_case_5(): """ 没标记 severity 的用例默认为 normal""" print("test case 5555555555")