How to Generate Extent Report in Cucumber Framework from scratch?
Vložit
- čas přidán 11. 09. 2024
- Step 1: Add extent report dependency in pom.xml
extentreports-cucumber7-adapter
Step 2: create extent.properties file in /src/main/resources/ add below contents.
extent.reporter.spark.start=true
extent.reporter.spark.out=Report/extent.html
screenshot.dir=Screenshots/
screenshot.rel.path=../Screenshots/
basefolder.name=test-output/ExtentReport
basefolder.datetimepattern=d-MMM-YY HH-mm-ss
Step 3: Add AfterStep annotation in step definition file
@AfterStep
public void addScreenshot(Scenario scenario) {
final byte[] screenshot = ((TakesScreenshot)driver).getScreenshotAs(OutputType.BYTES);
scenario.attach(screenshot, "image/png", scenario.getName());
}
Step 4 : Add Extent report plugin in runner class
"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"
Great video...nice explanation.Thank you ❤
Glad it was helpful!