extentreports-java
extentreports-java copied to clipboard
In extent report log, how to add test step and exception when an exception is thrown
Hi
// new instance
ExtentReports extent = new ExtentReports(file-path, replaceExisting);
// starting test
ExtentTest test = extent.startTest("Test Name", "Sample description");
// step log
test.log(LogStatus.PASS, "Step details");
try {
File file = new File("E://file.txt");
FileReader fr = new FileReader(file);
}catch(Exception e) {
test.log(LogStatus.FAIL, "unable to find file path", e);
}
// ending test
extent.endTest(test);
// writing everything to document
extent.flush();
test.log(LogStatus.FAIL, "unable to find file path", e);
Currently I only see exception being logged. Why it does not print step details "unable to find file path" as well when exception is thrown?
Thank you!