我正在testNG
使用Selenium webdriver2.0
.
在我的testNG.xml
我有
<suite data-provider-thread-count="2" name="selenium FrontEnd Test" parallel="false" skipfailedinvocationCounts="false" thread-count="2">
<parameter name="config_file" value="src/test/resources/config.properties/"/>
<test annotations="JDK" junit="false" name="CarInsurance Sanity Test" skipfailedinvocationCounts="false" verbose="2">
<parameter name="config-file" value="src/test/resources/config.properties/"/>
<groups>
<run>
<include name="abstract"/>
<include name="Sanity"/>
</run>
</groups>
<classes>
</classes>
</test>
</suite>
在java文件中
@BeforeSuite(groups = { "abstract" } )
@Parameters(value = { "config-file" })
public void initFramework(String configfile) throws Exception
{
Reporter.log("Invoked init Method \n",true);
Properties p = new Properties();
FileInputStream conf = new FileInputStream(configfile);
p.load(conf);
siteurl = p.getProperty("BASEURL");
browser = p.getProperty("BROWSER");
browserloc = p.getProperty("BROWSERLOC");
}
得到错误为
AILED CONFIGURATION:@BeforeSuite initFramework org.testng.TestNGException:@Configuration 方法 initFramework 需要参数“config-file”,但尚未标记为 @Optional 或在
如何使用@Parameters
资源文件?