簡體   English   中英

有什么辦法可以將org.testng.ITestResult或ITestNGMethod轉換為java.lang.reflect.Method。

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM