Class: DecisionAgent::Testing::TestResult
- Inherits:
-
Object
- Object
- DecisionAgent::Testing::TestResult
- Defined in:
- lib/decision_agent/testing/batch_test_runner.rb
Overview
Result of a single test scenario execution
Instance Attribute Summary collapse
-
#confidence ⇒ Object
readonly
Returns the value of attribute confidence.
-
#decision ⇒ Object
readonly
Returns the value of attribute decision.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#evaluations ⇒ Object
readonly
Returns the value of attribute evaluations.
-
#execution_time_ms ⇒ Object
readonly
Returns the value of attribute execution_time_ms.
-
#scenario_id ⇒ Object
readonly
Returns the value of attribute scenario_id.
Instance Method Summary collapse
-
#initialize(scenario_id:, decision: nil, confidence: nil, execution_time_ms: 0, error: nil, evaluations: []) ⇒ TestResult
constructor
A new instance of TestResult.
- #success? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(scenario_id:, decision: nil, confidence: nil, execution_time_ms: 0, error: nil, evaluations: []) ⇒ TestResult
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/decision_agent/testing/batch_test_runner.rb', line 11 def initialize(scenario_id:, decision: nil, confidence: nil, execution_time_ms: 0, error: nil, evaluations: []) @scenario_id = scenario_id.to_s.freeze @decision = decision&.to_s&.freeze @confidence = confidence&.to_f @execution_time_ms = execution_time_ms.to_f @error = error @evaluations = evaluations.freeze freeze end |
Instance Attribute Details
#confidence ⇒ Object (readonly)
Returns the value of attribute confidence.
9 10 11 |
# File 'lib/decision_agent/testing/batch_test_runner.rb', line 9 def confidence @confidence end |
#decision ⇒ Object (readonly)
Returns the value of attribute decision.
9 10 11 |
# File 'lib/decision_agent/testing/batch_test_runner.rb', line 9 def decision @decision end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
9 10 11 |
# File 'lib/decision_agent/testing/batch_test_runner.rb', line 9 def error @error end |
#evaluations ⇒ Object (readonly)
Returns the value of attribute evaluations.
9 10 11 |
# File 'lib/decision_agent/testing/batch_test_runner.rb', line 9 def evaluations @evaluations end |
#execution_time_ms ⇒ Object (readonly)
Returns the value of attribute execution_time_ms.
9 10 11 |
# File 'lib/decision_agent/testing/batch_test_runner.rb', line 9 def execution_time_ms @execution_time_ms end |
#scenario_id ⇒ Object (readonly)
Returns the value of attribute scenario_id.
9 10 11 |
# File 'lib/decision_agent/testing/batch_test_runner.rb', line 9 def scenario_id @scenario_id end |
Instance Method Details
#success? ⇒ Boolean
22 23 24 |
# File 'lib/decision_agent/testing/batch_test_runner.rb', line 22 def success? @error.nil? end |
#to_h ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/decision_agent/testing/batch_test_runner.rb', line 26 def to_h { scenario_id: @scenario_id, decision: @decision, confidence: @confidence, execution_time_ms: @execution_time_ms, error: @error&., success: success?, evaluations: @evaluations.map { |e| e.respond_to?(:to_h) ? e.to_h : e } } end |