Class: Cyrun::SpecGroupExecutionResult
- Inherits:
-
Object
- Object
- Cyrun::SpecGroupExecutionResult
- Defined in:
- lib/cyrun/spec_group_execution_result.rb
Instance Attribute Summary collapse
-
#gross_time_in_seconds ⇒ Object
readonly
Returns the value of attribute gross_time_in_seconds.
-
#screenshots ⇒ Object
readonly
Returns the value of attribute screenshots.
-
#single_results ⇒ Object
readonly
Returns the value of attribute single_results.
Class Method Summary collapse
Instance Method Summary collapse
- #clear_screenshot_list! ⇒ Object
- #effectiveness ⇒ Object
-
#initialize(single_results, screenshots, gross_time_in_seconds) ⇒ SpecGroupExecutionResult
constructor
A new instance of SpecGroupExecutionResult.
- #latest_results ⇒ Object
- #merge!(other) ⇒ Object
- #net_time_in_seconds ⇒ Object
- #task_fail_count(task) ⇒ Object
- #task_result_count(task) ⇒ Object
- #task_results(task) ⇒ Object
Constructor Details
#initialize(single_results, screenshots, gross_time_in_seconds) ⇒ SpecGroupExecutionResult
Returns a new instance of SpecGroupExecutionResult.
11 12 13 14 15 |
# File 'lib/cyrun/spec_group_execution_result.rb', line 11 def initialize(single_results, screenshots, gross_time_in_seconds) @single_results = single_results @gross_time_in_seconds = gross_time_in_seconds @screenshots = screenshots end |
Instance Attribute Details
#gross_time_in_seconds ⇒ Object (readonly)
Returns the value of attribute gross_time_in_seconds.
5 6 7 |
# File 'lib/cyrun/spec_group_execution_result.rb', line 5 def gross_time_in_seconds @gross_time_in_seconds end |
#screenshots ⇒ Object (readonly)
Returns the value of attribute screenshots.
5 6 7 |
# File 'lib/cyrun/spec_group_execution_result.rb', line 5 def screenshots @screenshots end |
#single_results ⇒ Object (readonly)
Returns the value of attribute single_results.
5 6 7 |
# File 'lib/cyrun/spec_group_execution_result.rb', line 5 def single_results @single_results end |
Class Method Details
.create_empty ⇒ Object
7 8 9 |
# File 'lib/cyrun/spec_group_execution_result.rb', line 7 def self.create_empty SpecGroupExecutionResult.new([], [], 0) end |
Instance Method Details
#clear_screenshot_list! ⇒ Object
56 57 58 |
# File 'lib/cyrun/spec_group_execution_result.rb', line 56 def clear_screenshot_list! @screenshots = [] end |
#effectiveness ⇒ Object
21 22 23 24 25 |
# File 'lib/cyrun/spec_group_execution_result.rb', line 21 def effectiveness return 0.0 if gross_time_in_seconds.zero? net_time_in_seconds.to_f / gross_time_in_seconds end |
#latest_results ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/cyrun/spec_group_execution_result.rb', line 48 def latest_results tasks = single_results.map(&:task).uniq tasks.map do |task| task_results(task).last end end |
#merge!(other) ⇒ Object
27 28 29 30 31 |
# File 'lib/cyrun/spec_group_execution_result.rb', line 27 def merge!(other) @single_results += other.single_results @gross_time_in_seconds += other.gross_time_in_seconds @screenshots += other.screenshots end |
#net_time_in_seconds ⇒ Object
17 18 19 |
# File 'lib/cyrun/spec_group_execution_result.rb', line 17 def net_time_in_seconds single_results.map(&:net_time_in_seconds).sum end |
#task_fail_count(task) ⇒ Object
33 34 35 36 37 |
# File 'lib/cyrun/spec_group_execution_result.rb', line 33 def task_fail_count(task) single_results .select { |result| !result.success && result.task == task } .size end |
#task_result_count(task) ⇒ Object
39 40 41 |
# File 'lib/cyrun/spec_group_execution_result.rb', line 39 def task_result_count(task) task_results(task).size end |
#task_results(task) ⇒ Object
43 44 45 46 |
# File 'lib/cyrun/spec_group_execution_result.rb', line 43 def task_results(task) single_results .select { |result| result.task == task } end |