Iterate through internal data file

Is it possible to iterate through the internal data file row in a test script? gives the following sample code:

TestData product = findTestData(GlobalVariable.dataFile)
List<String> productList = 
        .map{data -> data[0]}           /* get first column of each row in data file */
        .collect(Collectors.toList())   /* add collect and parse to list*/


Would you know what needs to be changed in this code if I want to get first row in a data file instead of column?


a List that contains all data of each rows, which each item is a List of raw data from each cell in that row

If you are not familiar with the “Stream API” of java, you can use usual “for” loop.

for (int xRow = 0; xRow < product.size(); xRow++) {
    List<String> row = product.get(xRow)
    for (int xCol = 0; xCol < row.size(); xCol++) {
        String value = row.get(xCol)
        println "(${xRow},${xCol}) ${value}"