【发布时间】:2015-03-19 08:19:59
【问题描述】:
我还有一些其他测试上下文,其中包含要导入和读取的自定义逻辑 “测试配置文件”
但是
@DataProvider(name = "testdata")
public Object[][] testdata(ITestContext context) {
Map<String, String> parameters = context.getCurrentXmlTest()
.getAllParameters();
System.out.println("-------");
Iterator it = parameters.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry) it.next();
String x = (String) pairs.getValue();
if (x.startsWith("created_")
&& !pairs.getKey().toString().contains("shareData")) {
String y = (String) universalMap.get(x);
parameters.put((String) pairs.getKey(), y);
}
}
return new Object[][] { { parameters } };
}
它无法检测到 context 有一个 getCurrentXmlTest() 方法,即使在类型转换为
之后也是如此Map<String, String> parameters = (((ITestContext)context).getCurrentXmlTest())
.getAllParameters();
仍然会抛出:-
The method getCurrentXmlTest() is undefined for the type ITestContext
【问题讨论】:
标签: java unit-testing automated-tests integration-testing testng