testng.xml

 

testng xml配置文件

xml文件样例

1)选择一个包中的全部测试脚本(包含子包)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="All Test Suite">
<test verbose="2" preserve-order="true"
name="/Users/andy/meishiSCFTest/src/test/java/scf.meishiservices/testcase/IUserInfoServiceSCFTest.java">
<packages>
<package name="scf.videoserviceprovider.testcase.*"> </package>
</packages>
</test>
</suite>

2)选择一个类中的全部测试脚本

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="All Test Suite">
<test verbose="2" preserve-order="true"
name="/Users/andy/meishiSCFTest/src/test/java/scf.meishiservices/testcase/IUserInfoServiceSCFTest.java">
<classes>
<class name="scf.videoserviceprovider.testcase.VdoMeetingServiceSCFTest"/>
</classes>
</test>
</suite>

3)选择一个类中的部分测试脚本

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="All Test Suite">
<test verbose="2" preserve-order="true"
name="/Users/andy/meishiSCFTest/src/test/java/scf.meishiservices/testcase/IUserInfoServiceSCFTest.java">
<classes>
<class name="scf.meishiservices.testcase.IUserInfoServiceSCFTest">
<methods>
<include name="refreshTest"/>
<include name="getUserInfoByBspIdsTest"/>
<include name="disableMeishiUserTest"/>
<include name="getUserStatusTest"/>
<include name="getUserInfoByBspIdTest3"/>
<include name="getUserInfoAndGroupInfoByVersionTest"/>
<include name="getUserPortraitURLTest"/>
</methods>
</class>
</classes>
</test>
</suite>

4)选择一个包中的某些组

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Fourth suite" verbose="1" >
<test name = "includedGroupsInAPackage" >
   <groups>
      <run>
         <include name = "includedGroup" />
      </run>
   </groups>
   <packages>
      <package name = "whole.path.to.package.* /> </packages> </test> </suite>

5)排除一个包中的某些组

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Fifth suite" verbose="1" >
<test name = "excludedGroupsInAPackage" >
   <groups>
      <run>
         <exclude name = "excludedGroup" />
      </run>
   </groups>
   <packages>
      <package name = "whole.path.to.package.* /> </packages> </test> </suite>
posted @ 2019-05-23 14:37  贱贱的小帅哥  阅读(112)  评论(0编辑  收藏  举报