考虑以下TestNG配置,它运行com.example.functional.* pacakge中的所有测试: !DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" suite name="Functional1" verbose="1" test name="FunctionalTest" packages package name="com.exam
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="Functional1" verbose="1" > <test name="FunctionalTest" > <packages> <package name="com.example.functional.*"> </package> </packages> </test> </suite>
为了拆分测试作业,添加了一些排除规则:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="Functional1" verbose="1" > <test name="FunctionalTest" > <packages> <package name="com.example.functional.*"> <exclude name="com.example.functional.services.courier.*"></exclude> <exclude name="com.example.functional.optimization.*"></exclude> <exclude name="com.example.functional.initialization"></exclude> <exclude name="com.example.functional.tasks"></exclude> </package> </packages> </test> </suite>
被排除的包仍在执行 – 任何想法为什么忽略排除?
*是问题所在.排除优化.*时,不包括优化的子包,但优化不包括.从排除标记中删除*应该这样做:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="Functional1" verbose="1" > <test name="FunctionalTest" > <packages> <package name="com.example.functional.*"> <exclude name="com.example.functional.services.courier"></exclude> <exclude name="com.example.functional.optimization"></exclude> <exclude name="com.example.functional.initialization"></exclude> <exclude name="com.example.functional.tasks"></exclude> </package> </packages> </test> </suite>