Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用ExtentReports 3.2 jar java为多套testng套装/类/一套套装中的多套套装生成报告_Java_Testng_Extentreports - Fatal编程技术网

使用ExtentReports 3.2 jar java为多套testng套装/类/一套套装中的多套套装生成报告

使用ExtentReports 3.2 jar java为多套testng套装/类/一套套装中的多套套装生成报告,java,testng,extentreports,Java,Testng,Extentreports,我是个新手。我在youtube上看过很多视频 使用具有上述标题条件的ExtentReports生成报告 但是没有找到我想要的确切答案 当尝试在testng套件中执行多个类时 假设仅假设套件包含3的nullpointerexception 类(测试用例)。因为一流的执行非常顺利。一旦 跳转到第二个类,它表示NullPointerException。下面是我的 代码 注意:使用@BeforeTest和@AfterTest Tooo进行了尝试 公共类AppInit{ 公共扩展报告; 公共扩展测试信息;

我是个新手。我在youtube上看过很多视频 使用具有上述标题条件的ExtentReports生成报告 但是没有找到我想要的确切答案

当尝试在testng套件中执行多个类时 假设仅假设套件包含3的nullpointerexception 类(测试用例)。因为一流的执行非常顺利。一旦 跳转到第二个类,它表示NullPointerException。下面是我的 代码

注意:使用@BeforeTest和@AfterTest Tooo进行了尝试

公共类AppInit{
公共扩展报告;
公共扩展测试信息;
公共扩展TMLReporter htmlReporter;
@套房前
public void reportSetup(){
htmlReporter=newextenthtmlreporter(新文件(System.getProperty(“user.dir”)+“/AutomationReports.html”);
htmlReporter.loadXMLConfig(新文件(System.getProperty(“user.dir”)+“/src/resource/XML/Extent-Config.XML”);
报告=新的扩展端口();
htmlReporter.setAppendExisting(true);
报告。设置系统信息(“环境”、“自动化”);
报告。附件报告器(htmlReporter);
}
@预处理法
公共void testMethodName(方法){
String testName=method.getName();
testInfo=reports.createTest(testName);
}
@后置法
公共无效捕获\u测试状态(ITestResult结果){
试一试{
if(result.getStatus()==ITestResult.SUCCESS){
log(Status.PASS,“测试方法”+“”+result.getName()+“”+result.getStatus());
}else if(result.getStatus()==ITestResult.FAILURE){
log(Status.FAIL,“测试方法”+“”+result.getName()+“”+result.getStatus());
log(Status.FAIL,“Test error”+result.getThrowable());
}else if(result.getStatus()==ITestResult.SKIP){
log(Status.SKIP,“测试方法”+“”+result.getName()+“”+result.getStatus());
}
}捕获(例外e){
e、 printStackTrace();
}
}
@事后
公共无效生成器报告(){
reports.flush();
}
}
异常/错误

2018年3月30日10:21:07下午 main.java.com.xxx.yyy.framework.LogTestListener日志 信息:test.java.com.xxx.yyy.tests.modules.zzz.explore.Attributes#serialNumber 启动 2018年3月30日晚上10:21:21 main.java.com.xxx.yyy.framework.LogTestListener日志 信息:test.java.com.xxx.yyy.tests.modules.zzz.explore.Attributes\serialNumber 完整的 2018年3月30日晚上10:21:21 main.java.com.xxx.yyy.framework.LogTestListener日志 信息:test.java.com.xxx.yyy.tests.modules.zzz.explore.Capacity.aaa#poolName 启动 2018年3月30日晚上10:21:21 main.java.com.xxx.yyy.framework.LogTestListener日志 信息:test.java.com.xxx.yyy.tests.modules.zzz.explore.Capacity.aaa#poolName 跳过 2018年3月30日晚上10:21:21 main.java.com.xxx.yyy.framework.LogTestListener日志 信息:test.java.com.xxx.yyy.tests.modules.zzz.explore.Capacity.aaa# 启动 2018年3月30日晚上10:21:21 main.java.com.xxx.yyy.framework.LogTestListener日志 信息:test.java.com.xxx.yyy.tests.modules.zzz.explore.Capacity.aaa# 跳过 测试运行:9,失败:1,错误:0,跳过:7,运行时间:38.356秒 在maven(pom.xml)中执行多个testng套件


src/resource/TestNg_XML/zzz_Explore_Attributes.XML
请帮我解决这个问题。我没时间送了

提前感谢:)

应用程序类代码

package main.java.com.xxx.zzz.framework;

import java.io.File;
import java.lang.reflect.Method;
import java.util.concurrent.TimeUnit;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.w3c.dom.Document;

import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import com.aventstack.extentreports.reporter.ExtentHtmlReporter;

import page.pageactions.LoginPageActions;
import page.pageactions.reportlibrarypageactions.ReportLibraryPageActions;
import test.java.com.xxx.zzz.tests.modules.centralizedManagement.Collecting;
import test.java.com.xxx.zzz.tests.modules.centralizedManagement.Modify_PollingInterval;

public class AppInit {

    public static WebDriver driver;
    public String convertStatus;
    public String className;
    public String testCase_MethodName;
    public final static int Timer_Web_Element_Show = 30;

    public static String retrievedUserEnteredbbbNamezzzUI;

    public ExtentReports reports;
    public ExtentTest testInfo;
    public ExtentHtmlReporter htmlReporter;

    // XML Parser
    public static String resBodyXMLFilesPath;
    public static File file;
    public static DocumentBuilderFactory dbFactory;
    public static DocumentBuilder dBuilder;
    public static Document doc;
    public static XPath xPath;

    @BeforeSuite
    public void reportSetup() {

        htmlReporter = new ExtentHtmlReporter(new File(System.getProperty("user.dir") + "/AutomationReports.html"));
        htmlReporter.loadXMLConfig(new File(System.getProperty("user.dir") + "/src/resource/XML/Extent-Config.xml"));
        reports = new ExtentReports();
        htmlReporter.setAppendExisting(true);
        reports.setSystemInfo("Environment", "Automation");
        reports.attachReporter(htmlReporter);

    }

    @BeforeSuite
    @Parameters({ "browser", "sUsername", "sPassword" })
    public void setup(String browser, String sUsername, String sPassword) throws Exception {

        DataProviders.getPropertyData();
        CommonMethods.deleteFilesFromDirectory("TestCaseResult_FolderPath");
        // CommonMethods.deleteFilesFromDirectory("DownloadedFiles_Path");

        // Check if parameter passed from TestNG is 'firefox'
        if (browser.equalsIgnoreCase("firefox")) {
            FirefoxProfile profile = new FirefoxProfile();
            profile.setPreference("browser.download.folderList", 2);
            profile.setPreference("browser.download.manager.showWhenStarting", false);
            profile.setPreference("browser.download.dir",
                    CommonMethods.relativePath("", "\\src\\resource\\Downloaded_Files"));
            profile.setPreference("browser.helperApps.neverAsk.openFile",
                    "application/log,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;");
            profile.setPreference("browser.helperApps.neverAsk.saveToDisk",
                    "application/log,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;");
            profile.setPreference("browser.helperApps.alwaysAsk.force", false);
            profile.setPreference("browser.download.manager.alertOnEXEOpen", false);
            profile.setPreference("browser.download.manager.focusWhenStarting", false);
            profile.setPreference("browser.download.manager.useWindow", false);
            profile.setPreference("browser.download.manager.showAlertOnComplete", false);
            profile.setPreference("browser.download.manager.closeWhenDone", false);

            // create firefox instance
            // System.setProperty("webdriver.firefox.marionette",
            // ".\\geckodriver.exe");
            driver = new FirefoxDriver(profile);
        }
        // Check if parameter passed as 'chrome'
        else if (browser.equalsIgnoreCase("chrome")) {
            // set path to chromedriver.exe
            System.setProperty("webdriver.chrome.driver",
                    CommonMethods.relativePath("chromedriver.exe", "\\src\\lib\\"));
            // create chrome instance
            driver = new ChromeDriver();
        } else {
            // If no browser passed throw exception
            throw new Exception("Browser is not correct");
        }

        driver.get(CommonMethods.dp_DataCollector("url"));
        driver.manage().window().maximize();
        driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

        // Logging into zzz
        LoginPageActions.username(sUsername);
        LoginPageActions.password(sPassword);
        LoginPageActions.loginButton();


          Modify_PollingInterval.modify_TopologyPolling(); System.out.println(
          "Topology polling executed successfully");
          Modify_PollingInterval.modify_PerformancePolling();
          System.out.println("Performance Polling executed successfully");

          System.out.println("Modifying level and log file size started");
          CommonMethods.ssh_ExecuteCommand("Collector_UserName",
          "Collector_Password", "Collector_IP", "Collector_Port",
          "sed -i 's/INFO/FINEST/g' /opt/APG/Collecting/Collector-Manager/yyy-aaa/conf/logging.properties && (>&2 echo 'Success') || (>&2 echo 'Fail')"
          ); CommonMethods.ssh_ExecuteCommand("Collector_UserName",
          "Collector_Password", "Collector_IP", "Collector_Port",
          "sed -i 's/1048576/1000048576/g' /opt/APG/Collecting/Collector-Manager/yyy-aaa/conf/logging.properties  && (>&2 echo 'Success') || (>&2 echo 'Fail')"
          ); System.out.println("Modified level and log file size");

          System.out.println("Re-Starting collector manager started");
          CommonMethods.ssh_ExecuteCommand("Collector_UserName",
          "Collector_Password", "Collector_IP", "Collector_Port",
          "apg-collector-manager-yyy-aaa restart  && (>&2 echo 'Success') || (>&2 echo 'Fail')"
          ); CommonMethods.pauseTime(8); System.out.println(
          "Restarted collector manager");

          System.out.println("Verifying one successful poll");
          CommonMethods.polling_Check("Collector_UserName",
          "Collector_Password", "Collector_IP", "Collector_Port");
          System.out.println("One successful polling is done");

          System.out.println("Downloading the log file");
          CommonMethods.ssh_DownloadLogFile("Collector_UserName",
          "Collector_Password", "Collector_IP", "Collector_Port");
          System.out.println("Downloaded log file");

          CommonMethods.get_ResponceBodyfromLog(CommonMethods.
          retrieveLatestFileName_Downloaded().toString(),
          "CreateNew_LogFile_aaa", "StartPoint_aaa", "EndPoint_aaa");

          Collecting.dataBase_ImportPropertiesTask(); System.out.println(
          "Property store executed successfully");


        // Holding XML data in a doc for parsing it
        resBodyXMLFilesPath = System.getProperty("user.dir") + CommonMethods.dp_DataCollector("CreateNew_LogFile_aaa");
        file = new File(resBodyXMLFilesPath + ".xml");
        dbFactory = DocumentBuilderFactory.newInstance();
        dBuilder = dbFactory.newDocumentBuilder();
        doc = dBuilder.parse(file);
        doc.getDocumentElement().normalize();
        xPath = XPathFactory.newInstance().newXPath();

        retrievedUserEnteredbbbNamezzzUI = ReportLibraryPageActions.retrieveUserEnteredbbbName();
    }

    @BeforeMethod
    public void testMethodName(Method method) {

        String testName = method.getName();
        testInfo = reports.createTest(testName);

    }

    @AfterMethod
    public void capture_TestStatus(ITestResult result) {

        try {


            if (result.getStatus() == ITestResult.SUCCESS) {
                testInfo.log(Status.PASS, "Test method " + "'" + result.getName() + "'" + result.getStatus());
            } else if (result.getStatus() == ITestResult.FAILURE) {
                testInfo.log(Status.FAIL, "Test method " + "'" + result.getName() + "'" + result.getStatus());
                testInfo.log(Status.FAIL, "Test error " + result.getThrowable());
            } else if (result.getStatus() == ITestResult.SKIP) {
                testInfo.log(Status.SKIP, "Test method " + "'" + result.getName() + "'" + result.getStatus());
            }



        } catch (Exception e) {

            e.printStackTrace();

        }



    }

    @AfterSuite
    public void generateReport() {

        reports.flush();

    }

    @AfterSuite
    public void tearDown() {

        CommonMethods.pauseTime(5);

        // reports.flush();

        driver.quit();

    }

}
按建议修改代码

public class AppInit implements ISuiteListener, IInvokedMethodListener {
    public void onStart(ISuite suite){

            //Extent Reports
            htmlReporter = new ExtentHtmlReporter(new File(System.getProperty("user.dir") + "/AutomationReports.html"));
            htmlReporter.loadXMLConfig(new File(System.getProperty("user.dir") + "/src/resource/XML/Extent-Config.xml"));
            reports = new ExtentReports();
            htmlReporter.setAppendExisting(true);
            reports.setSystemInfo("Environment", "Automation");
            reports.attachReporter(htmlReporter);

            DataProviders.getPropertyData();
            CommonMethods.deleteFilesFromDirectory("TestCaseResult_FolderPath");
            // CommonMethods.deleteFilesFromDirectory("DownloadedFiles_Path");

            // Check if parameter passed from TestNG is 'firefox'
            String getBrowserInput = suite.getParameter("browser");
            if (getBrowserInput.equalsIgnoreCase("firefox")) {
                FirefoxProfile profile = new FirefoxProfile();
                profile.setPreference("browser.download.folderList", 2);
                profile.setPreference("browser.download.manager.showWhenStarting", false);
                profile.setPreference("browser.download.dir",
                        CommonMethods.relativePath("", "\\src\\resource\\Downloaded_Files"));
                profile.setPreference("browser.helperApps.neverAsk.openFile",
                        "application/log,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;");
                profile.setPreference("browser.helperApps.neverAsk.saveToDisk",
                        "application/log,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;");
                profile.setPreference("browser.helperApps.alwaysAsk.force", false);
                profile.setPreference("browser.download.manager.alertOnEXEOpen", false);
                profile.setPreference("browser.download.manager.focusWhenStarting", false);
                profile.setPreference("browser.download.manager.useWindow", false);
                profile.setPreference("browser.download.manager.showAlertOnComplete", false);
                profile.setPreference("browser.download.manager.closeWhenDone", false);

                // create firefox instance
                // System.setProperty("webdriver.firefox.marionette",
                // ".\\geckodriver.exe");
                driver = new FirefoxDriver(profile);
            }
            // Check if parameter passed as 'chrome'
            else if (getBrowserInput.equalsIgnoreCase("chrome")) {
                // set path to chromedriver.exe
                System.setProperty("webdriver.chrome.driver",
                        CommonMethods.relativePath("chromedriver.exe", "\\src\\lib\\"));
                // create chrome instance
                driver = new ChromeDriver();
            } else {
                // If no browser passed throw exception
                try {
                    throw new Exception("Browser is not correct");
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

            driver.get(CommonMethods.dp_DataCollector("url"));
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

            // Logging into aaa
            String getUserName = suite.getParameter("sUsername");
            String getPassword = suite.getParameter("sPassword");
            LoginPageActions.username(getUserName);
            LoginPageActions.password(getPassword);
            LoginPageActions.loginButton();

            resBodyXMLFilesPath = System.getProperty("user.dir") + CommonMethods.dp_DataCollector("CreateNew_LogFile_bbb");
            file = new File(resBodyXMLFilesPath + ".xml");
            dbFactory = DocumentBuilderFactory.newInstance();
            try {
                dBuilder = dbFactory.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            try {
                doc = dBuilder.parse(file);
            } catch (SAXException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            doc.getDocumentElement().normalize();
            xPath = XPathFactory.newInstance().newXPath();

            retrievedUserEnteredcccNameaaaUI = ReportLibraryPageActions.retrieveUserEnteredcccName();

        }

        public void onFinish(ISuite suite) {

            CommonMethods.pauseTime(5);

             reports.flush();

            driver.quit();

        }

        public void beforeInvocation(IInvokedMethod method, ITestResult testResult) {

            String testName = method.getTestMethod().getMethodName();
            testInfo = reports.createTest(testName);

        }

        public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
            if (testResult.getStatus() == ITestResult.SUCCESS) {
                testInfo.log(Status.PASS, "Test method " + "'" + testResult.getName() + "'" + testResult.getStatus());
            } else if (testResult.getStatus() == ITestResult.FAILURE) {
                testInfo.log(Status.FAIL, "Test method " + "'" + testResult.getName() + "'" + testResult.getStatus());
                testInfo.log(Status.FAIL, "Test error " + testResult.getThrowable());
            } else if (testResult.getStatus() == ITestResult.SKIP) {
                testInfo.log(Status.SKIP, "Test method " + "'" + testResult.getName() + "'" + testResult.getStatus());
            }

        }
}
删除侦听器后的输出

[信息]正在扫描项目。。。[信息]
[信息] ------------------------------------------------------------------------[信息]正在构建aaa 3.7-SNAPSHOT[信息] ------------------------------------------------------------------------[INFO][INFO]——maven资源插件:2.6:resources (默认资源)@aaa---[INFO]使用“UTF-8”编码进行复制 过滤资源。[信息]正在复制14个资源[信息][信息]--- maven编译器插件:3.1:compile(默认编译)@aaa---[INFO] 无需编译-所有类都是最新的[INFO][INFO]--- maven资源插件:2.6:testResources(默认testResources)@aaa ---[信息]使用“UTF-8”编码复制筛选的资源。[信息]跳过不存在的资源目录C:\zzz\bbb\aaa\src\test\resources [INFO][INFO]——maven编译器插件:3.1:testCompile (默认testCompile)@aaa---[INFO]检测到更改-重新编译 模块![信息]正在将13个源文件编译为 C:\zzz\bbb\aaa\target\test classes[INFO][INFO]--- maven surefire插件:2.18.1:test(默认测试)@aaa---[INFO] Surefire报告目录:C:\zzz\bbb\aaa\target\Surefire报告

-------------------------------------------------------T T S T S -------------------------------------------------------在运行TestSuite java.lang.NullPointerException时 com.google.common.base.premissions.checkNotNull(premissions.java:210) 在 org.openqa.selenium.support.ui.FluentWait.(FluentWait.java:94) 在 org.openqa.selenium.support.ui.WebDriverWait.(WebDriverWait.java:70) 在 org.openqa.selenium.support.ui.WebDriverWait.(WebDriverWait.java:44) 在 page.pageactions.CommonMethodsPageActions.clickOnUI(CommonMethodsPageActions.java:24) 在 test.java.com.xxx.yyy.tests.modules.ccc_ddd.reportlibrary.inventory.eee.poolName(eee.java:19) 位于的sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法) invoke(NativeMethodAccessorImpl.java:62) 在 reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:4
public class AppInit implements ISuiteListener, IInvokedMethodListener {
    public void onStart(ISuite suite){

            //Extent Reports
            htmlReporter = new ExtentHtmlReporter(new File(System.getProperty("user.dir") + "/AutomationReports.html"));
            htmlReporter.loadXMLConfig(new File(System.getProperty("user.dir") + "/src/resource/XML/Extent-Config.xml"));
            reports = new ExtentReports();
            htmlReporter.setAppendExisting(true);
            reports.setSystemInfo("Environment", "Automation");
            reports.attachReporter(htmlReporter);

            DataProviders.getPropertyData();
            CommonMethods.deleteFilesFromDirectory("TestCaseResult_FolderPath");
            // CommonMethods.deleteFilesFromDirectory("DownloadedFiles_Path");

            // Check if parameter passed from TestNG is 'firefox'
            String getBrowserInput = suite.getParameter("browser");
            if (getBrowserInput.equalsIgnoreCase("firefox")) {
                FirefoxProfile profile = new FirefoxProfile();
                profile.setPreference("browser.download.folderList", 2);
                profile.setPreference("browser.download.manager.showWhenStarting", false);
                profile.setPreference("browser.download.dir",
                        CommonMethods.relativePath("", "\\src\\resource\\Downloaded_Files"));
                profile.setPreference("browser.helperApps.neverAsk.openFile",
                        "application/log,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;");
                profile.setPreference("browser.helperApps.neverAsk.saveToDisk",
                        "application/log,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;");
                profile.setPreference("browser.helperApps.alwaysAsk.force", false);
                profile.setPreference("browser.download.manager.alertOnEXEOpen", false);
                profile.setPreference("browser.download.manager.focusWhenStarting", false);
                profile.setPreference("browser.download.manager.useWindow", false);
                profile.setPreference("browser.download.manager.showAlertOnComplete", false);
                profile.setPreference("browser.download.manager.closeWhenDone", false);

                // create firefox instance
                // System.setProperty("webdriver.firefox.marionette",
                // ".\\geckodriver.exe");
                driver = new FirefoxDriver(profile);
            }
            // Check if parameter passed as 'chrome'
            else if (getBrowserInput.equalsIgnoreCase("chrome")) {
                // set path to chromedriver.exe
                System.setProperty("webdriver.chrome.driver",
                        CommonMethods.relativePath("chromedriver.exe", "\\src\\lib\\"));
                // create chrome instance
                driver = new ChromeDriver();
            } else {
                // If no browser passed throw exception
                try {
                    throw new Exception("Browser is not correct");
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

            driver.get(CommonMethods.dp_DataCollector("url"));
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

            // Logging into aaa
            String getUserName = suite.getParameter("sUsername");
            String getPassword = suite.getParameter("sPassword");
            LoginPageActions.username(getUserName);
            LoginPageActions.password(getPassword);
            LoginPageActions.loginButton();

            resBodyXMLFilesPath = System.getProperty("user.dir") + CommonMethods.dp_DataCollector("CreateNew_LogFile_bbb");
            file = new File(resBodyXMLFilesPath + ".xml");
            dbFactory = DocumentBuilderFactory.newInstance();
            try {
                dBuilder = dbFactory.newDocumentBuilder();
            } catch (ParserConfigurationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            try {
                doc = dBuilder.parse(file);
            } catch (SAXException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            doc.getDocumentElement().normalize();
            xPath = XPathFactory.newInstance().newXPath();

            retrievedUserEnteredcccNameaaaUI = ReportLibraryPageActions.retrieveUserEnteredcccName();

        }

        public void onFinish(ISuite suite) {

            CommonMethods.pauseTime(5);

             reports.flush();

            driver.quit();

        }

        public void beforeInvocation(IInvokedMethod method, ITestResult testResult) {

            String testName = method.getTestMethod().getMethodName();
            testInfo = reports.createTest(testName);

        }

        public void afterInvocation(IInvokedMethod method, ITestResult testResult) {
            if (testResult.getStatus() == ITestResult.SUCCESS) {
                testInfo.log(Status.PASS, "Test method " + "'" + testResult.getName() + "'" + testResult.getStatus());
            } else if (testResult.getStatus() == ITestResult.FAILURE) {
                testInfo.log(Status.FAIL, "Test method " + "'" + testResult.getName() + "'" + testResult.getStatus());
                testInfo.log(Status.FAIL, "Test error " + testResult.getThrowable());
            } else if (testResult.getStatus() == ITestResult.SKIP) {
                testInfo.log(Status.SKIP, "Test method " + "'" + testResult.getName() + "'" + testResult.getStatus());
            }

        }
}
@BeforeSuite
// Invoking ExtentReports functionality
public void reportSetup() {

    htmlReporter = new ExtentHtmlReporter(new File(System.getProperty("user.dir") + "/AutomationReports.html"));
    htmlReporter.loadXMLConfig(new File(System.getProperty("user.dir") + "/src/resource/XML/Extent-Config.xml"));
    reports = new ExtentReports();
    reports.setSystemInfo("Environment", "Automation");
    reports.attachReporter(htmlReporter);

}

@BeforeMethod
public void testMethodName(Method method) {

    String testName = method.getName();
    testInfo = reports.createTest(testName);

}

@AfterMethod
public void capture_TestStatus(ITestResult result) {

    try {

        if (result.getStatus() == ITestResult.SUCCESS) {
            testInfo.log(Status.PASS, "Test method " + "'" + result.getName() + "'" + result.getStatus());
        } else if (result.getStatus() == ITestResult.FAILURE) {
            testInfo.log(Status.FAIL, "Test method " + "'" + result.getName() + "'" + result.getStatus());
            testInfo.log(Status.FAIL, "Test error " + result.getThrowable());
        } else if (result.getStatus() == ITestResult.SKIP) {
            testInfo.log(Status.SKIP, "Test method " + "'" + result.getName() + "'" + result.getStatus());
        }

    } catch (Exception e) {

        e.printStackTrace();

    }

}

@AfterSuite
public void tearDown() {

    CommonMethods.pauseTime(5);
    reports.flush();
    driver.quit();

}