mercredi 12 avril 2017

Attempting to convert List

Currently trying to convert a List> to Object[][] for the means of testing multiple tests from an excel sheet. This is the code I have at the moment.

@DataProvider(name = "Journey")
    public Object[][] generateJourneys() {
    Object[][] o = TestVariables.sourceSheet.toArray();
    return o;
    }    

The DataProvider should end up looking something like

    {
       {"TableEntry1", "TableEntry2", "TableEntry3"},
       {"TableEntry12", "TableEntry13", "TableEntry14"}
    }

I have a separate method to pull the excel file like this.

List<List<String>> sourceSheet = ExcelFileHandler.readFromFile("src/resourceSheet.xls");

So I can pull as the following code to get the first row, second column

  sourceSheet.get(0).get(1);

Aucun commentaire:

Enregistrer un commentaire