@Test public void testApp() { String startTime = null; TestReports.startSuite("Suite 1"); for (int tcid = 2; tcid <= Core.getRowCount("Suite1"); tcid++) { currentTest = Core.getCellData("Suite1", "TCID", tcid); // initilize start time of test if (Core.getCellData("Suite1", "Runmode", tcid).equals("Y")) { // executed the keywords // loop again - rows in test data int totalSets = testData.getRowCount(currentTest + "1"); ; // holds total rows in test data sheet. IF sheet does not exist then 2 by default if (totalSets <= 1) { totalSets = 2; // run atleast once } for (testRepeat = 2; testRepeat <= totalSets; testRepeat++) { startTime = TestUtil.now("dd.MMMMM.yyyy hh.mm.ss aaa"); APPLICATION_LOGS.debug("Executing the test " + currentTest); // implemented keywords file try { for (int tsid = 2; tsid <= Core.getRowCount(currentTest); tsid++) { // Get values from xls file keyword = Core.getCellData(currentTest, "Keyword", tsid); object = Core.getCellData(currentTest, "Object", tsid); currentTSID = Core.getCellData(currentTest, "TSID", tsid); stepDescription = Core.getCellData(currentTest, "Description", tsid); proceedOnFail = Core.getCellData(currentTest, "ProceedOnFail", tsid); data_column_name = Core.getCellData(currentTest, "Data_Column_Name", tsid); Method method = Keywords.class.getMethod(keyword); result = (String) method.invoke(method); APPLICATION_LOGS.debug("***Result of execution -- " + result); // take screenshot - every keyword String fileName = "Suite1_TC" + (tcid - 1) + "_TS" + tsid + "_" + keyword + testRepeat + ".jpg"; if (result.startsWith("Pass")) { testStatus = result; // Uncomment this one to capture screenshots in case of Pass, For every test step a // screenshot will be captured // TestUtil.captureScreenshot(CONFIG.getProperty("screenshotPath")+TestUtil.imageName+".jpeg"); TestReports.addKeyword( stepDescription, keyword, result, "http://" + TestUtil.Handeler() + ":8080//screenshots//" + TestUtil.imageNameIP + ".jpeg"); } else if (result.startsWith("Fail")) { testStatus = result; // take screenshot - only on error TestUtil.captureScreenshot( CONFIG.getProperty("screenshotPath") + TestUtil.imageName + ".jpeg"); // changed to make the screenshot path generic TestReports.addKeyword( stepDescription, keyword, result, "http://" + TestUtil.Handeler() + ":8080//screenshots//" + TestUtil.imageNameIP + ".jpeg"); if (proceedOnFail.equalsIgnoreCase("N")) { break; } break; } } } catch (Throwable t) { APPLICATION_LOGS.debug("Error came"); } // report pass or fail in HTML Report if (testStatus == null) { testStatus = "Pass"; } APPLICATION_LOGS.debug("######################" + currentTest + " --- " + testStatus); TestReports.addTestCase( currentTest, startTime, TestUtil.now("dd.MMMMM.yyyy hh.mm.ss aaa"), testStatus); if (result.startsWith("Fail")) { break; } } } else { APPLICATION_LOGS.debug("Skipping the test " + currentTest); testStatus = "Skip"; // report skipped APPLICATION_LOGS.debug("#######################" + currentTest + " --- " + testStatus); TestReports.addTestCase( currentTest, TestUtil.now("dd.MMMMM.yyyy hh.mm.ss aaa"), TestUtil.now("dd.MMMMM.yyyy hh.mm.ss aaa"), testStatus); } testStatus = null; if (result != null && result.startsWith("Fail")) { break; } } TestReports.endSuite(); }