0
votes

I have a selenium java framework which is module based. Its existing and ancient. I am not sure how to integrate Extent report to it. It has allure reports and the output is in xml. People want html reports which are kind of shareable. Please help

1

1 Answers

0
votes

To integrate selenium with extent report: Step 1 create blank html

ExtentHtmlReporter reporter=new ExtentHtmlReporter("HTML_Report_"+timeStamp+".html");

Step 2: create extent report object

ExtentReports extent = new ExtentReports();

Step 3: attach extent report object to html

   extent.attachReporter(reporter);

Step 4:

testlog= extent.createTest("Report String");

Step5: call these function to add steps and screenshots

    testlog.log(Status.PASS,"string description")

Step6:

extent.flush()

Create separate class for this report for example:

public class Report {
    
     
     
    public void setup()
    {
        String timeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date());//time stamp
        
        ExtentHtmlReporter reporter=new ExtentHtmlReporter("HTML_Report_"+timeStamp+".html");
        
        ExtentReports extent = new ExtentReports();
        
       extent.attachReporter(reporter);
        
        }
    
    public void createrepo(String TestCase)
    {
                
        logger=extent.createTest(TestCase);
    }
    
    
    
    public void tearDown() 
    {
        
            
        extent.flush();
        
        
    }
    
}