You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用qase-pytest插件提交嵌套测试套件?点符号失效问题

qase-pytest嵌套测试套件不生效的解决方案

问题原因

当前版本的qase-pytest插件不再支持通过点符号自动拆分生成嵌套套件,文档提及的该功能可能已被移除或无公开配置项支持,因此带点的字符串会被直接识别为单一的套件名称。

两种可行的实现方式

1. 叠加多个@qase.suite装饰器

给测试用例添加多层@qase.suite装饰,每个装饰器对应一层嵌套层级:

import pytest
from qaseio.pytest import qase

@qase.suite("First Suites")
@qase.suite("Second Suites")
@qase.suite("Third Suites")
def test_nested_example():
    assert 1 == 1

执行后会生成Root Suites/First Suites/Second Suites/Third Suites的嵌套结构。

2. 使用嵌套测试类

通过类的层级对应套件层级,每个类用@qase.suite装饰:

import pytest
from qaseio.pytest import qase

@qase.suite("First Suites")
class TestFirstLevel:
    @qase.suite("Second Suites")
    class TestSecondLevel:
        @qase.suite("Third Suites")
        def test_class_based_nested(self):
            assert True

这种方式更适合大型测试套件的结构化管理,层级关系一目了然。

补充提示

如果依赖文档中的点符号功能,建议核对当前插件版本与文档对应的版本是否一致,部分旧版本可能支持该特性,但新版本已调整实现方式。

内容的提问来源于stack exchange,提问作者Didit Setiawan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.16 15:17:40