【问题标题】:Test suite result dependency in testNGtestNG 中的测试套件结果依赖性
【发布时间】:2019-11-07 01:37:53
【问题描述】:

我有一个测试套件 xml 文件,其中包含以下格式的其他测试套件:

<suite-files>
    <suite-file path="debug1.xml" />
    <suite-file path="debug2.xml"/>

</suite-files>

有没有办法在两个子套件之间添加依赖关系?这意味着如果debug1.xml 失败,则根本不应该执行debug2.xml。 TestNG 不提供对&lt;suite-files&gt; 级别的任何依赖。这可以通过一些听众来完成吗?

【问题讨论】:

    标签: testing automated-tests testng suite testng.xml


    【解决方案1】:

    您可以在测试代码中定义TestNG groupsarrange the dependencieslike:

    <!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
    
    <suite name="test">
    
        <groups>
            <dependencies>
                <group name="debug1" depends-on=""/>
                <group name="debug2" depends-on="debug1"/>
            </dependencies>
        </groups>
        <suite-files>
            <suite-file path="debug1.xml"/>
            <suite-file path="debug2.xml"/>
        </suite-files>
    </suite>
    

    参考资料:

    【讨论】:

    • 感谢您的努力,但上述 xml sn-p 无效,因为您不能拥有组和套件文件。此外,分组似乎没有在并行模式下运行,并且依赖项对我来说不能正常工作。此外,我更喜欢在套件中组织我的测试,而不是按组名标记它们。这样对我来说更具可维护性。还有其他想法吗?
    猜你喜欢
    • 2015-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多