public class DriverScript {
public static ActionKeywords actionKeywords;
public static String sActionKeyword;
public static Properties OR;
public static String sPageObject;
//Reflection Class object
public static Method method[];
public static void main(String[] args) throws Exception {
String sPath = Constants.path_TestData;
ExcelUtils.setExcelFile(sPath, Constants.Sheet_TestSteps);
String Path_OR = Constants.Path_OR;
FileInputStream fs = new FileInputStream(Path_OR);
OR = new Properties(System.getProperties());
OR.load(fs);
actionKeywords = new ActionKeywords();
method = actionKeywords.getClass().getMethods();
for(int iRow=1;iRow<=9;iRow++){
sActionKeyword = ExcelUtils.getCellData(iRow, Constants.Col_ActionKeyword);
sPageObject = ExcelUtils.getCellData(iRow, Constants.Col_PageObject);
System.out.println(sPageObject);
execute_Actions();
}
}
private static void execute_Actions() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
for(int i=0;i<method.length;i++){
if(method[i].getName().equals(sActionKeyword)){
method[i].invoke(actionKeywords, sPageObject);
break;
}
}
} }
Aucun commentaire:
Enregistrer un commentaire