我正在为基于 TestNG 的自己的测试框架编写 suite.xml 。我的 xml 文件如下所示:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite" parallel="methods">
<test name="NewTest">
<parameter name="BROWSER" value="Chrome"></parameter>
<classes>
<class name="hm.NewTest">
<methods>
<include name="test"></include>
<include name="test2"></include>
<include name="test3"></include>
<include name="test4"></include>
</methods>
</class>
</classes>
</test>
</suite>
现在为完整测试指定了参数“BROWSER”。但我需要为每个包含的方法一个自己的参数。有谁知道解决方案吗?
为此,您可以单独为测试分配参数,而不是在测试套件 xml 中分配参数。为此,您不必在 suite.xml 中添加每个参数。
@Parameters({ "datasource", "jdbcDriver" })
@test
public void sampleTest(String ds, String driver) {
// your test method
}
希望对你有帮助1
http://testng.org/doc/documentation-main.html#parameters
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)