0

是否可以从传递给 DataProvider 的方法中获取 TextContext?这就是我的意思。。

@DataProvider(name= "foo")
public static Object[][] testData(Method method){
    TestContext tc = //possible?
    //reason for this, I want to get some property from TextContext
    Object x = tc.getAttribute("bar");
}
4

1 回答 1

2

只需声明您的ITestContextin 参数,TestNG 就会为您注入它:

@DataProvider(name= "foo")
public Object[][] testData(Method method, ITestContext context) {
于 2012-07-26T21:06:43.060 回答