1
我想在DataProvider方法中檢索Test方法的參數名稱。 通過在DataProvider中使用method.getParameterTypes()
,我可以得到在Test方法中傳遞的param類,但我想要名稱。如何檢索@DataProvider方法中的@Test方法參數?
@Test
public void TC_001(String userName, String passWord){
//code goes here
}
@DataProvider
public Object[][] testData(Method method){
//Here I want to get names of param of test method i.e. userName and passWord
}
這是必需的,因爲使用這些名稱我可以從我的Excel文件中的數據