I have 4 test scripts for my application. In every scripts, I am using data driven framework to test with multiple values. So each time in each script, I initialize the necessary variables which are almost common in all scripts. Is there any possible to way reuse these variables or constants in java or selenium??
below is my code
static String excel,sheet;
@BeforeClass
public void start(){
driver.findElement(By.id(""));
}
@DataProvider
public static Object[][] chartDetails() throws IOException{
excel = Init.readConfig("xls");
sheet = Init.readConfig("sheetName");
data = ReadData.getData(excel, sheet);
return data;
}
@Test(dataProvider="chartDetails")
public static void generateCharts(String standName,String termName) {
driver.findElement(By.id("script goes here"));
Assert.assertEquals("actual","expected");
}
In above code, the declaration part will be common in all modules. so i want to reuse the same variables.