@BeforeTest public void checkTestSkip() { if (!TestUtil.isTestCaseRunnable( suiteHomePageXls, this.getClass() .getSimpleName())) // suites XlSX name is passed by the object from base class. and name // of the TestCase. // Instead of passing TestCase name,using this "this.getClass().getSimpleName()" to get the name // of the class as the name of the class is the TestCase name. { // writing the Skip in the Xls file for the test case TestUtil.reportDataSetResult( suiteHomePageXls, "Test Cases", TestUtil.getRowNum(suiteHomePageXls, this.getClass().getSimpleName()), "Skip"); APP_LOGS.debug("skipping test HomePage_TC4 as the runmode is NO"); throw new SkipException( "Skipping this testcase as the runmode is NO for this testcase : Payment_TC2"); } // Load the RunModes of the Test runmodes = TestUtil.getDataSetRunmodes(suiteHomePageXls, this.getClass().getSimpleName()); }
@Test @AfterTest // Writing the final result for the TestCase whether it is passed or fail. public void testReporter() { if (istestpass) { TestUtil.reportDataSetResult( suiteHomePageXls, "Test Cases", TestUtil.getRowNum(suiteHomePageXls, this.getClass().getSimpleName()), "PASS"); } else TestUtil.reportDataSetResult( suiteHomePageXls, "Test Cases", TestUtil.getRowNum(suiteHomePageXls, this.getClass().getSimpleName()), "Fail"); }
@Test @AfterMethod public void testdataReporter() { System.out.println("value of skip" + count + skip); System.out.println("test case fail" + count + fail); // System.out.println("test case a"+count); if (skip) TestUtil.reportDataSetResult( suiteHomePageXls, this.getClass().getSimpleName(), count + 2, "Skip"); else if (fail) { TestUtil.reportDataSetResult( suiteHomePageXls, this.getClass().getSimpleName(), count + 2, "Fail"); istestpass = false; // checking for the TestCase is failed or passed } else TestUtil.reportDataSetResult( suiteHomePageXls, this.getClass().getSimpleName(), count + 2, "Pass"); skip = false; fail = false; }