Class ApiPerformanceExecutionReport

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

public class ApiPerformanceExecutionReport extends Object
Utility class for generating HTML-based API performance execution reports. Aggregates per-endpoint response-time statistics (count, min, max, average) collected during a test run and writes a self-contained HTML report file to the path configured by SHAFT.Properties.paths.performanceReportPath().

Report generation is guarded by the SHAFT.Properties.performance.isEnablePerformanceReport() flag and is skipped when that flag is false.

This class is not intended for direct use in test code; it is invoked by the SHAFT API performance-tracking infrastructure.

  • Constructor Details

    • ApiPerformanceExecutionReport

      public ApiPerformanceExecutionReport()
  • Method Details

    • generatePerformanceReport

      public static void generatePerformanceReport(Map<String, List<Double>> performanceData, long startTime, long endTime)
      Calculates per-endpoint performance statistics from the supplied data and writes a timestamped HTML report to the configured performance report directory.

      The method is a no-op when SHAFT.Properties.performance.isEnablePerformanceReport() returns false.

      Example:

      Map<String, List<Double>> data = new HashMap<>();
      data.put("/api/users", Arrays.asList(120.5, 98.3, 135.0));
      long start = System.currentTimeMillis();
      // ... run tests ...
      long end = System.currentTimeMillis();
      ApiPerformanceExecutionReport.generatePerformanceReport(data, start, end);
      
      Parameters:
      performanceData - a map where each key is an API endpoint path and each value is a list of individual response times in milliseconds
      startTime - the epoch-millisecond timestamp when the test suite began
      endTime - the epoch-millisecond timestamp when the test suite finished