A custom cucumber-jvm
report formatter using ExtentReports
- Maven / Java 8
Add the following to your list of dependencies in pom.xml
<dependency>
<groupId>com.sitture</groupId>
<artifactId>cucumber-jvm-extentsreport</artifactId>
<version>2.0.0</version>
</dependency>
Add the following if you're using gradle to your build.gradle
file.
compile 'com.sitture:cucumber-jvm-extentreport:2.0.0'
Add the following to your cucumber runner class:
@RunWith(Cucumber.class)
@CucumberOptions(
features = {"src/test/resources"},
plugin = {"com.sitture.ExtentFormatter:output/extent-report/index.html", "html:output/html-report"})
public class RunCukesTest {
@AfterClass
public static void setup() {
// Loads the extent config xml to customize on the report.
ExtentReporter.setConfig("src/test/resources/config.xml");
// adding system information
ExtentReporter.setSystemInfo("Browser", "Chrome");
ExtentReporter.setSystemInfo("Selenium", "v2.53.1");
}
}
The ExtentFormatter takes the location of reports directory as the parameter.
E.g. com.sitture.ExtentFormatter:output/extent-report/index.html
will generate the report at output/extent-report/index.html
.
Refer here to create the config xml file: ExtentReports Configuration To load the config file:
ExtentReporter.setConfig(new File("your config xml file path"));
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request