Class AllureManager
java.lang.Object
com.shaft.tools.io.internal.AllureManager
Internal utility class that manages the Allure reporting lifecycle for SHAFT test runs.
Responsibilities include downloading and extracting the Allure binary, initialising the
results directory, overriding Allure plugin configuration (custom logo / title), generating
the single-file HTML report, and optionally producing a ZIP archive.
This class is not intended for direct use in test code. It is invoked automatically by the SHAFT framework listeners at suite start and finish.
Thread safety: all public methods are static and intended to be called from a
single thread (the test runner thread). The Allure binary path and result directory fields
are mutable class-level state and should not be accessed concurrently.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidGenerates a self-contained ZIP archive of the Allure report whenSHAFT.Properties.allure.generateArchive()istrue.static voidInitialises the Allure reporting environment before a test suite begins.static voidGenerates the Allure HTML report and opens it in the default browser whenSHAFT.Properties.allure.automaticallyOpen()istrue.
-
Constructor Details
-
AllureManager
public AllureManager()
-
-
Method Details
-
initializeAllureReportingEnvironment
public static void initializeAllureReportingEnvironment()Initialises the Allure reporting environment before a test suite begins. This method:- Resolves the Allure results folder path from SHAFT properties.
- Optionally cleans the report and results directories.
- Downloads and extracts the Allure CLI binary if not already cached in
~/.m2. - Overrides the Allure plugin configuration with the custom logo and title.
- Writes convenience shell/batch scripts to the project root for manual report generation.
- Writes the current JVM system properties to
environment.xmlin the results directory.
Example (called automatically by SHAFT listeners):
AllureManager.initializeAllureReportingEnvironment(); -
openAllureReportAfterExecution
public static void openAllureReportAfterExecution()Generates the Allure HTML report and opens it in the default browser whenSHAFT.Properties.allure.automaticallyOpen()istrue. The generated report is copied to theallure-reportdirectory, renamed (optionally with a timestamp whenaccumulateReportsis enabled), and the intermediate output directory is deleted.Example (called automatically by SHAFT listeners after suite completion):
AllureManager.openAllureReportAfterExecution(); -
generateAllureReportArchive
public static void generateAllureReportArchive()Generates a self-contained ZIP archive of the Allure report whenSHAFT.Properties.allure.generateArchive()istrue. The archive is written to the project directory with a timestamped filename (e.g.generatedReport_2024-01-15_10-30-00-000.zip).This method is a no-op when archive generation is disabled in properties.
Example (called automatically by SHAFT listeners):
AllureManager.generateAllureReportArchive();
-