Class AllureManager
allurerc.yaml
configuration file, bootstrapping the Allure 3 CLI (downloaded automatically when not present),
invoking it to produce 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.
Allure 3 CLI resolution order (batteries-included):
- A globally installed
allurebinary already onPATH. npxonPATH→npx --yes allure@<version>(auto-downloads).- Portable Node.js downloaded to
~/.m2/repository/nodejs/→ its bundlednpx→ samenpx --yes allure@<version>invocation.
Thread safety: all public methods are static and intended to be called from a
single thread (the test runner thread). The result directory fields are mutable class-level
state and should not be accessed concurrently.
-
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.
-
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.
- 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.
The Allure 3 CLI is resolved (and downloaded if necessary) automatically at report-generation time; no separate installation step is required.
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();
-