Introduction
The EmailReporter creates an elegant, email-friendly report and support both BDD and non-BDD test styles. The email format is tested to work well with most major email clients and browsers.
Views
EmailReporter generates a single static HTML page without scripts or stylesheets. The static HTML page works well with all of the popular email clients.
Usage
Initialize
Start and attach EmailReporter using attachReporter
:
// directory where output is to be printed
var email = new ExtentEmailReporter("user/build/name/");
var extent = new ExtentReports();
extent.attachReporter(email);
Configuration
EmailReporter supports a host of configuration via XML and Java.
XML
To load configuration via XML, use LoadConfig()
.
// using the file path
email.LoadConfig("email-config.xml");
The below XML configuration is available to EmailReporter.
<?xml version="1.0" encoding="UTF-8"?>
<extentreports>
<configuration>
<!-- document encoding -->
<!-- defaults to UTF-8 -->
<encoding>UTF-8</encoding>
<!-- title of the document -->
<documentTitle>Extent Framework</documentTitle>
<!-- report name - displayed at top-nav -->
<reportName>Build 1</reportName>
<!-- timestamp format -->
<timeStampFormat>MMM dd, yyyy HH:mm:ss</timeStampFormat>
<!-- custom styles -->
<styles>
<![CDATA[
]]>
</styles>
</configuration>
</extentreports>
C#
It is also possible to configure the reporter directly from code:
email.Config.CSS = "";
email.Config.DocumentTitle = ""
email.Config.Encoding = "utf-8";
email.Config.ReportName = "";