Record Class EvaluationResult

java.lang.Object
java.lang.Record
dev.agenor.tools.eval.EvaluationResult
Record Components:
scenarioId - identifier of the evaluated scenario
status - overall evaluation status
executionTime - total time taken
metrics - collected metrics during execution
healthReport - health check results
assertions - individual assertion results
errorMessage - error message if status is ERROR
timestamp - when evaluation completed

public record EvaluationResult(String scenarioId, EvaluationResult.Status status, Duration executionTime, MetricsService.MetricsSnapshot metrics, HealthCheckService.HealthReport healthReport, List<AssertionResult> assertions, String errorMessage, Instant timestamp) extends Record
Result of evaluating a scenario against an agent or system.

Contains all information about the evaluation including timing, metrics, health status, and individual assertion results.

Since:
0.5.0
  • Constructor Details

  • Method Details

    • passed

      public static EvaluationResult passed(String scenarioId, Duration executionTime, MetricsService.MetricsSnapshot metrics, HealthCheckService.HealthReport healthReport, List<AssertionResult> assertions)
      Creates a passed result.
      Parameters:
      scenarioId - scenario ID
      executionTime - time taken
      metrics - collected metrics
      healthReport - health results
      assertions - assertion results (all passed)
      Returns:
      passed result
    • failed

      public static EvaluationResult failed(String scenarioId, Duration executionTime, MetricsService.MetricsSnapshot metrics, HealthCheckService.HealthReport healthReport, List<AssertionResult> assertions)
      Creates a failed result.
      Parameters:
      scenarioId - scenario ID
      executionTime - time taken
      metrics - collected metrics
      healthReport - health results
      assertions - assertion results (some failed)
      Returns:
      failed result
    • error

      public static EvaluationResult error(String scenarioId, Duration executionTime, String errorMessage)
      Creates an error result.
      Parameters:
      scenarioId - scenario ID
      executionTime - time taken before error
      errorMessage - error description
      Returns:
      error result
    • timeout

      public static EvaluationResult timeout(String scenarioId, Duration timeout)
      Creates a timeout result.
      Parameters:
      scenarioId - scenario ID
      timeout - configured timeout
      Returns:
      timeout result
    • skipped

      public static EvaluationResult skipped(String scenarioId, String reason)
      Creates a skipped result.
      Parameters:
      scenarioId - scenario ID
      reason - skip reason
      Returns:
      skipped result
    • passed

      public boolean passed()
      Checks if evaluation passed.
      Returns:
      true if all assertions passed
    • failed

      public boolean failed()
      Checks if evaluation failed.
      Returns:
      true if any assertion failed
    • passedCount

      public long passedCount()
      Gets the count of passed assertions.
      Returns:
      number of passed assertions
    • failedCount

      public long failedCount()
      Gets the count of failed assertions.
      Returns:
      number of failed assertions
    • successRate

      public double successRate()
      Gets the success rate as a percentage.
      Returns:
      success rate (0.0 to 100.0)
    • failedAssertions

      public List<AssertionResult> failedAssertions()
      Gets only the failed assertions.
      Returns:
      list of failed assertions
    • format

      public String format()
      Formats the result for display.
      Returns:
      formatted result string
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • scenarioId

      public String scenarioId()
      Returns the value of the scenarioId record component.
      Returns:
      the value of the scenarioId record component
    • status

      public EvaluationResult.Status status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component
    • executionTime

      public Duration executionTime()
      Returns the value of the executionTime record component.
      Returns:
      the value of the executionTime record component
    • metrics

      Returns the value of the metrics record component.
      Returns:
      the value of the metrics record component
    • healthReport

      public HealthCheckService.HealthReport healthReport()
      Returns the value of the healthReport record component.
      Returns:
      the value of the healthReport record component
    • assertions

      public List<AssertionResult> assertions()
      Returns the value of the assertions record component.
      Returns:
      the value of the assertions record component
    • errorMessage

      public String errorMessage()
      Returns the value of the errorMessage record component.
      Returns:
      the value of the errorMessage record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component