I am trying to save an extent report to my documents folder. I am getting an access is denied problem.
I have tried giving java full control, through all the user groups. I have given jetbrains full control as well but still access is denied.
This is where I am trying to save the file.
public void beforeSuite() {
extent = ExtentManager.createInstance("MobileCustomerCare_" + fileName + ".html");
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(System.getProperty("user.home") + "//Documents/ExtentReport//");
extent.attachReporter(htmlReporter);
I have added the ExtentManager class where the instance gets created
public class ExtentManager {
private static ExtentReports extent;
private static String fileName = new SimpleDateFormat("yyyy-MM-dd-HH-mm").format(new Date());
static ExtentReports createInstance(String fileName) {
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(fileName);
htmlReporter.config().setTestViewChartLocation(ChartLocation.BOTTOM);
htmlReporter.config().setChartVisibilityOnOpen(true);
htmlReporter.config().setTheme(Theme.DARK);
htmlReporter.config().setDocumentTitle(fileName);
htmlReporter.config().setEncoding("utf-8");
htmlReporter.config().setReportName(fileName);
extent = new ExtentReports();
extent.attachReporter(htmlReporter);
return extent;
}
}
EDIT: I have now changed to use ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter(System.getProperty("user.home") + "//Documents/ExtentReport//");
But still getting (access is denied)
I am expecting it to save the file in the location specified. What it's actually doing is saving it in my project.