Package dev.agenor.tools.eval
Record Class EvaluationResult
java.lang.Object
java.lang.Record
dev.agenor.tools.eval.EvaluationResult
- Record Components:
scenarioId- identifier of the evaluated scenariostatus- overall evaluation statusexecutionTime- total time takenmetrics- collected metrics during executionhealthReport- health check resultsassertions- individual assertion resultserrorMessage- error message if status is ERRORtimestamp- 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
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionEvaluationResult(String scenarioId, EvaluationResult.Status status, Duration executionTime, MetricsService.MetricsSnapshot metrics, HealthCheckService.HealthReport healthReport, List<AssertionResult> assertions, String errorMessage, Instant timestamp) Compact constructor with validation. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theassertionsrecord component.final booleanIndicates whether some other object is "equal to" this one.static EvaluationResultCreates an error result.Returns the value of theerrorMessagerecord component.Returns the value of theexecutionTimerecord component.booleanfailed()Checks if evaluation failed.static EvaluationResultfailed(String scenarioId, Duration executionTime, MetricsService.MetricsSnapshot metrics, HealthCheckService.HealthReport healthReport, List<AssertionResult> assertions) Creates a failed result.Gets only the failed assertions.longGets the count of failed assertions.format()Formats the result for display.final inthashCode()Returns a hash code value for this object.Returns the value of thehealthReportrecord component.metrics()Returns the value of themetricsrecord component.booleanpassed()Checks if evaluation passed.static EvaluationResultpassed(String scenarioId, Duration executionTime, MetricsService.MetricsSnapshot metrics, HealthCheckService.HealthReport healthReport, List<AssertionResult> assertions) Creates a passed result.longGets the count of passed assertions.Returns the value of thescenarioIdrecord component.static EvaluationResultCreates a skipped result.status()Returns the value of thestatusrecord component.doubleGets the success rate as a percentage.static EvaluationResultCreates a timeout result.Returns the value of thetimestamprecord component.toString()Returns a string representation of this record class.
-
Constructor Details
-
EvaluationResult
public EvaluationResult(String scenarioId, EvaluationResult.Status status, Duration executionTime, MetricsService.MetricsSnapshot metrics, HealthCheckService.HealthReport healthReport, List<AssertionResult> assertions, String errorMessage, Instant timestamp) Compact constructor with validation.
-
-
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 IDexecutionTime- time takenmetrics- collected metricshealthReport- health resultsassertions- 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 IDexecutionTime- time takenmetrics- collected metricshealthReport- health resultsassertions- 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 IDexecutionTime- time taken before errorerrorMessage- error description- Returns:
- error result
-
timeout
Creates a timeout result.- Parameters:
scenarioId- scenario IDtimeout- configured timeout- Returns:
- timeout result
-
skipped
Creates a skipped result.- Parameters:
scenarioId- scenario IDreason- 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
Gets only the failed assertions.- Returns:
- list of failed assertions
-
format
Formats the result for display.- Returns:
- formatted result 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. -
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. -
equals
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 withObjects::equals(Object,Object). -
scenarioId
Returns the value of thescenarioIdrecord component.- Returns:
- the value of the
scenarioIdrecord component
-
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
executionTime
Returns the value of theexecutionTimerecord component.- Returns:
- the value of the
executionTimerecord component
-
metrics
Returns the value of themetricsrecord component.- Returns:
- the value of the
metricsrecord component
-
healthReport
Returns the value of thehealthReportrecord component.- Returns:
- the value of the
healthReportrecord component
-
assertions
Returns the value of theassertionsrecord component.- Returns:
- the value of the
assertionsrecord component
-
errorMessage
Returns the value of theerrorMessagerecord component.- Returns:
- the value of the
errorMessagerecord component
-
timestamp
Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-