I wanted to use testdata from excel file with page object model here is the code:
TestData.java
public class TestData {
public void testData() throws Exception {
String filePath = "C:\\eclipes\\testdata\\testdata.xlsx";
FileInputStream fis = new FileInputStream(filePath);
XSSFWorkbook workbook = new XSSFWorkbook(fis);
//get cell data
XSSFCell data1 = workbook.getSheetAt(0).getRow(1).getCell(0); //A2
XSSFCell data2 = workbook.getSheetAt(0).getRow(2).getCell(0); //B2
in my Test.java file
public class TestSample extends BaseClass {
@Test
public void tc_01() throws Exception {
String excelData1 = TestData.data1;
}
Am I missing something?
TestData class does not return the data1 value.
or should I need to initialize data1 and 2 in TestData class?