1.
<!DOCTYPE suite SYSTEM "http://testng.org/testng- 1.0.dtd" >
<suite name="Suite1" verbose="1" >
<test name="Nopackage" >
<classes>
<class name="NoPackageTest" />
</classes>
</test>
<test name="Regression1" >
<classes>
<class name="test.sample.ParameterSample" />
<class name="test.sample.ParameterTest" />
</classes>
</test>
</suite>
2.你可以指定包名替代类名:
<!DOCTYPE suite SYSTEM "http://testng.org/testng- 1.0.dtd" >
<suite name="Suite1" verbose="1" >
<test name="Regression1" >
<packages>
<package name="test.sample" />
</packages>
</test>
</suite>
3.在这个例子中,TestNG将在包test.sample中查找所有的类,并只保留带有TestNG annotation的类。
你同样可以指定包含或不包含的组和方法:
<test name="Regression1">
<groups>
<run>
<exclude name="brokenTests" />
<include name="checkinTests" />
</run>
</groups>
<classes>
<class name="test.IndividualMethodsTest">
<methods>
<include name="testMethod" />
</methods>
</class>
</classes>
</test>