将范围报告集成到现有硒框架

问题描述

我有一个基于模块的Selenium Java框架。其存在而古老。我不确定如何将范围报告集成到其中。它具有诱人的报告,并且输出为xml。人们想要可共享的html报告。请帮忙

解决方法

要将硒与范围报告集成在一起: 第1步创建空白html

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

第2步:创建范围报告对象

ExtentReports extent = new ExtentReports();

步骤3:将范围报告对象附加到html

   extent.attachReporter(reporter);

第4步:

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

第5步: 调用这些功能以添加步骤和屏幕截图

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

Step6:

extent.flush()

为此报告创建单独的类 例如:

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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...