Class AllureManager

java.lang.Object
com.shaft.tools.io.internal.AllureManager

public class AllureManager extends Object
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 Details

    • AllureManager

      public AllureManager()
  • Method Details

    • initializeAllureReportingEnvironment

      public static void initializeAllureReportingEnvironment()
      Initialises the Allure reporting environment before a test suite begins. This method:
      1. Resolves the Allure results folder path from SHAFT properties.
      2. Optionally cleans the report and results directories.
      3. Downloads and extracts the Allure CLI binary if not already cached in ~/.m2.
      4. Overrides the Allure plugin configuration with the custom logo and title.
      5. Writes convenience shell/batch scripts to the project root for manual report generation.
      6. Writes the current JVM system properties to environment.xml in 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 when SHAFT.Properties.allure.automaticallyOpen() is true. The generated report is copied to the allure-report directory, renamed (optionally with a timestamp when accumulateReports is 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 when SHAFT.Properties.allure.generateArchive() is true. 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();