2016-04-21 73 views
1

我想獲得每次運行測試類時執行的測試方法。我用下面的代碼有沒有什麼辦法可以從`org.testng.ITestResult`` ITestNGMethod`轉換爲`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.ITestResultITestNGMethod轉換爲java.lang.reflect.Method

回答

4

你不想getConstructorOrMethod()the documentation?然後getMethod()上返回ConstructorOrMethod對象會給你的基本方法

相關問題