Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extent Report no generating html

Hi I am trying to create report through Extent Report; the code gives no error and runs successfully but there is no html report generated. Can anyone please help below is my code -

package ca.automation.com;

import org.testng.annotations.Test;
import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;
import org.testng.annotations.BeforeTest;
import org.junit.Assert;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.annotations.AfterClass;

public class ExtentReport {

    WebDriver driver;
    ExtentReports extent;
    ExtentTest test;

    @BeforeTest
    public void startReport(){
        extent = new ExtentReports("C:\\Report.html", true);
    }

    @Test
    public void installapp() {
        test = extent.startTest("installapp");
        System.setProperty("webdriver.ie.driver", "C:\\Anuj\\Downloads\\IEDriverServer_Win32_2.46.0\\IEDriverServer.exe");
        driver = new InternetExplorerDriver();
        driver.manage().window().maximize();
        driver.get("https://www.tripadvisor.com/");
        String Title = driver.getTitle();
        Assert.assertTrue(Title.contains("Trip"));
        extent.endTest(test);
    }
}
like image 703
Anuj Shrivastav Avatar asked Dec 15 '22 04:12

Anuj Shrivastav


1 Answers

Append extent.flush(); at the end of the test method to write all the test logs to the report file.

like image 171
ADHITHYA SRINIVASAN Avatar answered Dec 18 '22 12:12

ADHITHYA SRINIVASAN