How can I add timestamps to the HTML report for the test run start/end and for scenario start/end in Cucumber-JVM?
Is there a Cucumber option I can add to RunWith JUnit runner?
How can I add timestamps to the HTML report for the test run start/end and for scenario start/end in Cucumber-JVM?
Is there a Cucumber option I can add to RunWith JUnit runner?
It's simple!!!!!!
Don't mention any folder path in plugin com.cucumber.listener.ExtentCucumberFormatter.
Example :
plugin= { "pretty", "html:FeaturesReport", "html:target/site/cucumber-pretty", "json:target/cucumber.json",
"com.cucumber.listener.ExtentCucumberFormatter:",
},
If you want to generate a report in a specified path with a timestamp
just follow the below steps.
goto maven dependencies.
search cucumber-extentsreport.jar
extend jar and select com.cucumber.listener package
copy entire code in ExtentProperties class
right on package and create new enum with name of ExtentProperties
then paste ExtentProperties class code in the created enum.
search below method
ExtentProperties() {
this.reportPath = "output" + File.separator + "Run_" + System.currentTimeMillis() +File.separator+ "report.html";
this.projectName = "default";
}
8.And Replace With below code
String timeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date());
String userDir =System.getProperty("user.dir");
ExtentProperties()
{
this.reportPath = "Extent_Reports" + File.separator + "" +
timeStamp.replace(":","").replace(".","_") + File.separator + "Execution
report.html";
this.projectName = "default";
}
10.check report will generate in specified path with the name.
Extent_Reports/_2020_06_16_19_14_07/Execution report.html
Please comment if you have any questions