我想获取每次运行测试类时执行的测试方法。我使用以下代码
@AfterMethod
public void logout(ITestResult result){
Method method=result.getMethod(); //compliation error- Type mismatch: cannot convert from ITestNGMethod to Method
readAnnotation(method);
}
有没有办法从org.testng.ITestResult
ITestNGMethod
转换为java.lang.reflect.Method
最佳答案
您不想按照the documentation的方式使用getConstructorOrMethod()
吗? ?然后返回的 ConstructorOrMethod
对象上的 getMethod()
将为您提供底层方法
关于java - 有没有办法从 `org.testng.ITestResult` `ITestNGMethod` 转换为 `java.lang.reflect.Method`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36764985/