Class FlakeProfiler

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

public final class FlakeProfiler extends Object
Collects opt-in action timing, wait, retry, locator, healing, and evidence-cost signals.
  • Method Details

    • isEnabled

      public static boolean isEnabled()
      Returns whether flake profiling is enabled for the current thread.
      Returns:
      true when profiler collection is enabled
    • reset

      public static void reset()
      Clears all profiler state.
    • startTest

      public static void startTest(TestExecutionInfo info)
      Starts a test-scoped profile.
      Parameters:
      info - test metadata
    • finishTest

      public static void finishTest(TestExecutionInfo info, String status)
      Finishes and optionally attaches the current test profile.
      Parameters:
      info - test metadata
      status - final test status text
    • recordAction

      public static void recordAction(FlakeProfiler.ActionSample sample)
      Records one completed action boundary.
      Parameters:
      sample - action sample to add to the current test profile
    • recordEvidenceCapture

      public static void recordEvidenceCapture(String category, String name, long durationMillis)
      Records the time spent capturing a report artifact.
      Parameters:
      category - evidence category
      name - evidence name
      durationMillis - elapsed capture duration
    • recordRetryAttempt

      public static void recordRetryAttempt(String testName, int attempt, int maxAttempts, boolean supportingEvidenceEnabled)
      Records a retry attempt and supporting-evidence state.
      Parameters:
      testName - test method name
      attempt - retry attempt number
      maxAttempts - configured maximum retry attempts
      supportingEvidenceEnabled - whether enhanced evidence capture is enabled
    • reportAndGetFailure

      public static AssertionError reportAndGetFailure()
      Writes the suite-level report and returns a configured severe-risk failure.
      Returns:
      assertion error when severe flake risk should fail the run; otherwise null