SparkReporter
ExtentSparkReporter is a rich-HTML reporter available from the standard ExtentReports library. This section outlines a few unique features present.
ExtentReports extent = new ExtentReports();
ExtentSparkReporter spark = new ExtentSparkReporter("target/Spark.html");
extent.attachReporter(spark);
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
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:
final File CONF = new File("config/spark-config.json");
ExtentSparkReporter spark = new ExtentSparkReporter("target/spark/spark.html");
spark.loadJSONConfig(CONF);
Anchors
Test anchors can be used to quickly navigate to any given test from a uri component. An anchor will be generated for each test by default and will appear to the right of the test's timestamp.
To navigate to the test using the anchor, simply add the uri component at the end of the report path:
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