RE: if i have 50 test cases in my excel sheet…i want only first 20 test cases to be executed by using excel driven framework…then how can i do this?
Answered
Need urgent help for interview…..
Best answer
Refer the below code snippet:
Sheet sheet = Workbook.getSheet(sheetName);
//Find number of rows in excel file
int rowCount = sheet.getLastRowNum()- sheet.getFirstRowNum();
//Create a loop over all the rows of excel file to read it
for (int i = 0; i < rowCount+1; i++) { //Here you can choose how many times the loop need to be run 20 in ur case.
Row row = sheet.getRow(i);
//Create a loop to print cell values in a row
for (int j = 0; j < row.getLastCellNum(); j++) {
//Print excel data in console
System.out.print(row.getCell(j).getStringCellValue()+”|| “);
Thanks…