I want to get the test method that was executed each time when the test class is run. I use the following code
@AfterMethod
public void logout(ITestResult result){
Method method=result.getMethod(); //compliation error- Type mismatch: cannot convert from ITestNGMethod to Method
readAnnotation(method);
}
Is there any way to convert from org.testng.ITestResult
ITestNGMethod
to java.lang.reflect.Method
Don't you want getConstructorOrMethod()
as per the documentation ? Then getMethod()
on the returned ConstructorOrMethod
object will give you the underlying method
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.