Introduction

The LoggerReporter generates a logger style report and supports both BDD and non-BDD test styles. The default report is created in dark-theme, but it can be easily changed from XML or Java configuration (see Configuration section for details).


Views

LoggerReporter generates the following views:

  • Test
  • Tag
  • Bug
  • Dashboard
Test
Tag
Bug
Dashboard

Samples

LoggerReporter supports both BDD and non-BDD test styles. You can view both samples here.

bdd   standard


Usage


Initialize

Start and attach LoggerReporter using AttachReporter:

// directory where output is to be printed
var logger = new ExtentLoggerReporter("user/build/name/");
var extent = new ExtentReports();
extent.AttachReporter(logger);

Shortcuts

A few shortcuts are available to speed up common tasks.


Filters
p - show passed tests
e - show error tests
f - show failed tests
s - show skipped tests
w - show warning tests
esc - clear filters
Misc
l - switch theme

Configuration

LoggerReporter supports a host of configuration via XML and Java.


XML

To load configuration via XML, use LoadXmlConfig().

// using the file path
logger.LoadXmlConfig("logger-config.xml");

The below XML configuration is available to LoggerReporter.

<?xml version="1.0" encoding="UTF-8"?>
<extentreports>
    <configuration>
        <!-- report theme -->
        <!-- standard, dark -->
        <theme>standard</theme>
    
        <!-- document encoding -->
        <!-- defaults to UTF-8 -->
        <encoding>UTF-8</encoding>
        
        <!-- enable or disable timeline on dashboard -->
        <enableTimeline>true</enableTimeline>
        
        <!-- protocol for script and stylesheets -->
        <!-- defaults to https -->
        <protocol>https</protocol>
        
        <!-- title of the document -->
        <documentTitle>Extent Framework</documentTitle>
        
        <!-- report name - displayed at top-nav -->
        <reportName>Build 1</reportName>

        <!-- custom javascript -->
        <scripts>
            <![CDATA[
                $(document).ready(function() {
                    
                });
            ]]>
        </scripts>
        
        <!-- custom styles -->
        <styles>
            <![CDATA[
                
            ]]>
        </styles>
    </configuration>
</extentreports>

Java

It is also possible to configure the reporter directly from code:

logger.Config.EnableTimeline = true;
logger.Config.CSS = "css-string";
logger.Config.DocumentTitle = "page title";
logger.Config.Encoding = "utf-8";
logger.Config.JS = "js-string";
logger.Config.Protocol = Protocol.HTTPS;
logger.Config.ReportName = "build name";
logger.Config.Theme = Theme.Dark;