@DataProvider (name=getData)
public static Object[][] getData(){
Excelreader excel = new Excelreader("C:\\WorkspaceExcel\\Datasource.xlsx"); private static
String sheetName="SmokeTest"; // Test Data stored in a a table with
columns and rows. Ex. UserNmae and password are the columns and data
for them in rows private static String tableName="CreatePolicy";
// Some logic to read the data table store the data in a 2
dimentional array.
// Some logic by which I store the columns as Keys and data for them
as values in a HASHTABLE Return the hashtable
}
@Test (dataProvider="getData")
public void testData(Hashtable<String, String> data){
/* Logic to read an .xlsx file which has Snenario name, TestCase Name and its corespnding runflag. If the runflag is true i need to read the scenario name and testcase name from the .xlsx file. */
/* I need some logic to pass the ScenarioName (equivalent to Sheetname in DP) and TestCase Name (equivalent to datatable name in DP) which i am getting by reading the excelfile to DataProvider, so i can get the data which i need to execute the test case */
/*I am doing the above as part of Hybridframework, where i have Scenario, TC, Test step details in one excel sheet and data for each testcase in one more sheet */
}
Моят въпрос: Искам някаква логика, така че когато @Test се изпълнява, трябва динамично да предам данните File Path, SheetName, TableName, така че да може да се използва един и същ доставчик на данни и това ще ми даде различен набор от данни, върху които да работя.
Забележка: Доставчикът на данни ще върне под формата на хеш-таблица за данните, посочени в excel, в табличен формат с име на таблица. Така че, ако пътят на работния лист, името на листа и името на таблицата са предадени на доставчика на данни, тогава моят DP ще прочете тази таблица и ще върне цялата таблица с данни под формата на хеш таблица.