Selenium testNG 中未生成 ExtentReport

ExtentReport is not generated in Selenium testNG

我已经计划自定义 testNG 报告。所以我在下面的代码中使用了 ExtentReports。

Selenium 运行正常,没有任何问题,但报告未在指定的文件夹位置生成。

我在我的 pom.xml 文件中添加了 ExtentReport 2.41.2 maven 依赖项。

示例代码:

public class ExtentA
{
     public static ExtentReports extent;
     public static ExtentTest logger;
     public static WebDriver driver;

     @BeforeSuite
     public void config()
     {
        extent = new ExtentReports("E:/Automation/MyReport.html", true);
        extent.loadConfig(new File("E:/Automation/extentreports-java-2.41.2/extentreports-java-2.41.2/extent-config.xml"));
     }

     @BeforeMethod
     public void beforeMtd(Method method)
     {
        logger = extent.startTest("sample", "test case desc");
        logger.assignAuthor("Mohan");

     }

     @Test
     public void sample()
     {
        System.setProperty("webdriver.chrome.driver", "C:/selenium/drivers/chromedriver.exe");
        driver = new ChromeDriver();
        driver.get("https://www.google.co.in");
        logger.log(LogStatus.PASS, "Browser Launched successfully");
        System.out.println("Browser launched");
        driver.manage().window().maximize();
     }

     @AfterMethod
     public void close()
     {
        driver.close();
        driver.quit();
        extent.endTest(logger);
     }
}

在运行测试用例之前,我已经在loca中创建了html文件,但是没有生成报告。

extent.flush(); 添加到关闭方法的末尾。