且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用 Selenium/TestNG/Maven 运行单个测试用例(方法)而不是整个测试套件(类)

更新时间:2023-02-20 21:12:43

可以在xml文件中指定更多的测试方法

You can specify test method more in xml file

<groups>
        <run>
            <include name="setName"></include>
        </run>
    </groups>
    <classes>
        <class name="com.journaldev.xml.TestNGXMLTest">
        </class>
    </classes>

以上测试套件只会执行 setName 组中的方法,因此只会执行 test_setName 方法.

Above test suite will only execute methods in setName group, so only test_setName method will be executed.