0

您好我正在尝试通过范围报告创建报告;该代码没有给出错误并成功运行,但生成的 html 报告为空白。任何人都可以在下面提供帮助是我的代码还附上我的报告示例 -报告示例

public class VerifyLoginPageWithReport 
{

    WebDriver driver;
    String email = DataProviderFactory.getExcel().getData(0, 0, 0);
    String pass = DataProviderFactory.getExcel().getData(0, 0, 1);

    ExtentReports report;
    ExtentTest logger;

    @BeforeTest
    public void setup() 
    {
    report = new ExtentReports("\\Reports\\LoginPageReport.html", true);
    // Start the test using the ExtentTest class object
    logger = report.startTest("VerifyLoginPage", "This page will verify signout link");
    // passing browser type and url
    driver = BrowserFactory.getBrowser("chrome");
    driver.get(DataProviderFactory.getConfig().getApplicationUrl());
    logger.log(LogStatus.INFO, "Application is up and running");
    }

    @Test
    public void testHomePage()
    {    
    // initialize the home page
    HomePage home = PageFactory.initElements(driver, HomePage.class);
    String title = home.getApplicationTitle();
    // verifying the homepage
    Assert.assertTrue(title.contains("Online Shopping"));
    logger.log(LogStatus.PASS, "HomePage Loaded and verified");
    home.clickOnSignInLink();
    logger.log(LogStatus.INFO, "Sign In link clicked");
    // Initialzing login page
    LoginPage login = PageFactory.initElements(driver, LoginPage.class);
    // passing credentials
    login.loginApplication(email, pass);
    logger.log(LogStatus.INFO, "Login to application");
    // Verifying the signoutlink
    login.verifySignOutLink();
    logger.log(LogStatus.PASS, "Signout link verifed");
    }

    @AfterTest
    public void tearDown()
    {
    BrowserFactory.closeBrowser(driver);
    report.endTest(logger);
    report.flush();
    }
}
4

0 回答 0