Class: Ace::Test::EndToEndRunner::Models::TestResult
- Inherits:
-
Object
- Object
- Ace::Test::EndToEndRunner::Models::TestResult
- Defined in:
- lib/ace/test/end_to_end_runner/models/test_result.rb
Overview
Data model representing the result of an E2E test execution
Contains the status, individual test case results, and metadata from executing a test scenario via LLM.
Instance Attribute Summary collapse
-
#completed_at ⇒ Object
readonly
Returns the value of attribute completed_at.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#observations ⇒ Object
readonly
Returns the value of attribute observations.
-
#report_dir ⇒ Object
readonly
Returns the value of attribute report_dir.
-
#started_at ⇒ Object
readonly
Returns the value of attribute started_at.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
-
#test_cases ⇒ Object
readonly
Returns the value of attribute test_cases.
-
#test_id ⇒ Object
readonly
Returns the value of attribute test_id.
Instance Method Summary collapse
-
#duration ⇒ Float
Duration in seconds.
-
#duration_display ⇒ String
Human-readable duration string.
-
#failed? ⇒ Boolean
Check if the test failed (non-pass, non-skip status).
-
#failed_count ⇒ Integer
Count of failed test cases.
-
#failed_test_case_ids ⇒ Array<String>
IDs of failed test cases.
-
#initialize(test_id:, status:, test_cases: [], summary: "", started_at: nil, completed_at: nil, report_dir: nil, error: nil, observations: "", metadata: {}) ⇒ TestResult
constructor
A new instance of TestResult.
-
#passed_count ⇒ Integer
Count of passed test cases.
-
#skipped? ⇒ Boolean
Check if the test was skipped.
-
#success? ⇒ Boolean
Check if the test passed.
-
#total_count ⇒ Integer
Total number of test cases.
-
#with_report_dir(dir) ⇒ TestResult
Return a copy with the report_dir set.
Constructor Details
#initialize(test_id:, status:, test_cases: [], summary: "", started_at: nil, completed_at: nil, report_dir: nil, error: nil, observations: "", metadata: {}) ⇒ TestResult
Returns a new instance of TestResult.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 25 def initialize(test_id:, status:, test_cases: [], summary: "", started_at: nil, completed_at: nil, report_dir: nil, error: nil, observations: "", metadata: {}) @test_id = test_id @status = status @test_cases = test_cases @summary = summary @started_at = started_at || Time.now @completed_at = completed_at || Time.now @report_dir = report_dir @error = error @observations = observations.to_s @metadata = end |
Instance Attribute Details
#completed_at ⇒ Object (readonly)
Returns the value of attribute completed_at.
12 13 14 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 12 def completed_at @completed_at end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
12 13 14 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 12 def error @error end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
12 13 14 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 12 def @metadata end |
#observations ⇒ Object (readonly)
Returns the value of attribute observations.
12 13 14 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 12 def observations @observations end |
#report_dir ⇒ Object (readonly)
Returns the value of attribute report_dir.
12 13 14 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 12 def report_dir @report_dir end |
#started_at ⇒ Object (readonly)
Returns the value of attribute started_at.
12 13 14 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 12 def started_at @started_at end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
12 13 14 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 12 def status @status end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
12 13 14 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 12 def summary @summary end |
#test_cases ⇒ Object (readonly)
Returns the value of attribute test_cases.
12 13 14 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 12 def test_cases @test_cases end |
#test_id ⇒ Object (readonly)
Returns the value of attribute test_id.
12 13 14 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 12 def test_id @test_id end |
Instance Method Details
#duration ⇒ Float
Duration in seconds
85 86 87 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 85 def duration (completed_at - started_at).to_f end |
#duration_display ⇒ String
Human-readable duration string
109 110 111 112 113 114 115 116 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 109 def duration_display d = duration if d < 60 "#{d.round(1)}s" else "#{(d / 60).floor}m #{(d % 60).round(0)}s" end end |
#failed? ⇒ Boolean
Check if the test failed (non-pass, non-skip status)
47 48 49 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 47 def failed? !success? && !skipped? end |
#failed_count ⇒ Integer
Count of failed test cases
65 66 67 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 65 def failed_count test_cases.count { |tc| tc[:status] == "fail" } end |
#failed_test_case_ids ⇒ Array<String>
IDs of failed test cases
77 78 79 80 81 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 77 def failed_test_case_ids test_cases .select { |tc| tc[:status] == "fail" } .map { |tc| tc[:id] } end |
#passed_count ⇒ Integer
Count of passed test cases
59 60 61 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 59 def passed_count test_cases.count { |tc| tc[:status] == "pass" } end |
#skipped? ⇒ Boolean
Check if the test was skipped
53 54 55 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 53 def skipped? status == "skip" end |
#success? ⇒ Boolean
Check if the test passed
41 42 43 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 41 def success? status == "pass" end |
#total_count ⇒ Integer
Total number of test cases
71 72 73 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 71 def total_count test_cases.size end |
#with_report_dir(dir) ⇒ TestResult
Return a copy with the report_dir set
92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/ace/test/end_to_end_runner/models/test_result.rb', line 92 def with_report_dir(dir) TestResult.new( test_id: test_id, status: status, test_cases: test_cases, summary: summary, started_at: started_at, completed_at: completed_at, report_dir: dir, error: error, observations: observations, metadata: ) end |