配置文件:testng-parameter.xml
<?xmlversion="1.0"encoding="UTF-8"?>
<!DOCTYPEsuiteSYSTEM"
http://testng.org/testng-1.0.dtd">
<!--data-provider-thread-count="20"共享線程池配置-->
<suitename="framework_testng"data-provider-thread-count="20">
<parametername="first-name"value="Cedric"/>
<parametername="count"value="8"/>
<parametername="datasource"value="com.dbcp.source"/>
<parametername="jdbcDriver"value="com.mysql.jdbc.driver"/>
<parametername="poolSize"value="10"/>
<testverbose="2"name="TestGroups">
<classes>
<classname="com.dragon.testng.annotation.TestngParameters"/>
</classes>
</test>
</suite>
測試結(jié)果:
com.dbcp.source --- com.mysql.jdbc.driver --- 10
db .. mysql
com.dbcp.source --- com.mysql.jdbc.driver --- 10
Invoked count 8
com.dbcp.source --- com.mysql.jdbc.driver --- 10
Invoked testString Cedric
PASSED: testNonExistentParameter("mysql")
PASSED: testSingleInteger(8)
PASSED: testSingleString("Cedric")
===============================================
TestGroups
Tests run: 3, Failures: 0, Skips: 0
===============================================