@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 */
}
My Question: I want some logic, so when @Test is executed, I should dynamically pass the data File Path, SheetName, TableName, so the same data provider can be used and that will give me different set of data to work upon.
Note: The data provider will return in the form of a hashtable for the data specified in excel in a tabularformat with a table name. So if worksheet path, sheetname and table name is passed to the dataprovider, then my DP will read that table and return the whole data table in the form of a hash table.