
utilities.allure.AllureReportHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of AUTOTESTIMATIC-JAVA Show documentation
Show all versions of AUTOTESTIMATIC-JAVA Show documentation
An open-source Selenium Java-based Test automation Framework that allows you to perform multiple actions
to test a web application's functionality, behaviour, which provides easy to use syntax,
and easy to set up environment according to the needed requirements for testing
package utilities.allure;
import utilities.LoggingManager;
import java.io.*;
import java.nio.file.Files;
public class AllureReportHelper {
private static final File allureReportDir = new File("target/allure-results");
private AllureReportHelper() {
}
public static void cleanAllureReport(){
if (allureReportDir.exists()) {
File[] reportFiles = allureReportDir.listFiles();
assert reportFiles != null;
for (File file : reportFiles) {
if (file.isDirectory()) {
deleteDirectory(file);
} else {
try {
Files.delete(file.toPath());
} catch (IOException e) {
LoggingManager.error("File Not Found, " + e.getMessage());
}
}
}
LoggingManager.info("Allure Report Cleaned successfully");
}
else {
LoggingManager.info("Allure Report Already Cleaned");
}
}
private static void deleteDirectory(File directory) {
File[] files = directory.listFiles();
if (files != null) {
for (File file : files) {
if (file.isDirectory()) {
deleteDirectory(file);
} else {
try {
Files.delete(file.toPath());
} catch (IOException e) {
LoggingManager.error("File Not Found, " + e.getMessage());
}
}
}
}
try {
Files.delete(directory.toPath());
} catch (IOException e) {
LoggingManager.error("Directory Not Found, " + e.getMessage());
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy