Skip to content

ExtentSparkReporter

Anshoo Arora edited this page Aug 13, 2020 · 3 revisions

ExtentSparkReporter is a rich-HTML reporter available from the standard ExtentReports library. This section outlines a few unique features present.

Configuration

You can apply custom configuration to each reporter using XML, JSON or Java.

Java

spark.config(
  ExtentSparkReporterConfig.builder()
    .theme(Theme.DARK)
    .documentTitle("MyReport")
    .build()
);

// or:

ExtentSparkReporter spark = new ExtentSparkReporter("spark.html");
spark.config().setTheme(Theme.DARK);
spark.config().setDocumentTitle("MyReport");

XML

View spark-config.xml

final File CONF = new File("config/spark-config.xml");
ExtentSparkReporter spark = new ExtentSparkReporter("target/spark/spark.html");
spark.loadXMLConfig(CONF);

JSON

Version 4 and earlier had the ability to consume configuration-XML files, a functionality that remained unchanged in v5.0. External configuration can now be loaded via JSON also, as demonstrated below:

View spark-config.json

final File CONF = new File("config/spark-config.json");
ExtentSparkReporter spark = new ExtentSparkReporter("target/spark/spark.html");
spark.loadJSONConfig(CONF);

Anchors

An anchor will be generated for each test by default. It will appear at the right-side when you open any test, like so:

#test-id=2

To navigate to the test using the anchor, simply add the uri component at the end of the report URL;

http://path/to/index.html#test-id=2

Shortcuts

Navigation

t - test
c - tag
d - dashboard
x - exception/bug

Filters

p - show passed tests
f - show failed tests
s - show skipped tests
w - show warning tests
esc - clear filters

Scroll

down-arrow - scroll down
up-arrow - scroll up

Misc

l - switch theme
Clone this wiki locally