![](/img/trans.png)
[英]Getting a Template/Generic java.lang.reflect.Method object from org.aspectj.lang.ProceedingJoinPoint
[英]Is there any way to convert from `org.testng.ITestResult` `ITestNGMethod` to `java.lang.reflect.Method`
我想獲取每次運行測試類時執行的測試方法。 我使用以下代碼
@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
您是否getConstructorOrMethod()
按照文檔 getConstructorOrMethod()
? 然后,返回的ConstructorOrMethod
對象上的getMethod()
將為您提供基礎方法
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.