Extent Report no generating html

Anuj Shrivastav picture Anuj Shrivastav · Aug 16, 2016 · Viewed 18.7k times · Source

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);
    }
}

Answer

ADHITHYA SRINIVASAN picture ADHITHYA SRINIVASAN · Nov 17, 2016

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