这会导致大量的调试混乱,我认为必须有一种方法来防止这种情况。现在,如果一个测试方法不存在(比如拼写错误),套件将跳过该方法并继续下一个没有问题的方法。这会导致很多问题,而且很难找到原因。这是一个例子:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Sampoe_testSuite" preserve-order="true">
<listeners>
<listener class-name="framework.Listener"/>
</listeners>
<test name="Sample_TestSuite-Part1" preserve-order="true">
<classes>
<class name="tests.FirstTest">
<methods>
<include name="firstMethod"/>
</methods>
</class>
<class name="tests.SecondTest">
<methods>
<include name="secondMethod"/>
<include name="thirdMethod"/>
</methods>
</class>
<class name="tests.ThirdTest">
<methods>
<include name="fourthMethod"/>
</methods>
</class>
</classes>
</test>
</suite>
假设我拼错了 SecondTest 的 secondMethod。它实际上是代码中的 sceondMethod。当我运行这个套件时,不会有错误,但会发生什么:
Runs FirstTest.firstMethod
Runs SecondTest.thirdMethod
Runs ThirdTest.fourthMethod
请注意,它只是跳过拼写错误的方法并愉快地继续。我希望它使套件失败并说缺少方法。那可能吗?