Class: Inferno::Entities::TestSession
- Defined in:
- lib/inferno/entities/test_session.rb
Overview
A TestSession
represents an individual testing session.
Constant Summary collapse
- ATTRIBUTES =
[ :id, :created_at, :updated_at, :test_suite_id, :test_suite, :test_runs, :results, :suite_options ].freeze
Instance Attribute Summary collapse
-
#created_at ⇒ Time
Creation timestamp.
-
#id ⇒ String
Id of the session.
-
#results ⇒ Array<Inferno::Entities::TestResult>
associated with this session.
-
#suite_options ⇒ Hash
The suite options associated with this session.
-
#test_runs ⇒ Array<Inferno::Entities::TestRun>
with this session.
-
#test_suite ⇒ Inferno::Entities::TestSuite
session.
-
#test_suite_id ⇒ String
Id of the
TestSuite
being run in this session. -
#updated_at ⇒ Time
Update timestamp.
Instance Method Summary collapse
-
#initialize(params) ⇒ TestSession
constructor
A new instance of TestSession.
-
#suite_options_hash ⇒ Object
-
#to_hash ⇒ Object
Constructor Details
#initialize(params) ⇒ TestSession
Returns a new instance of TestSession.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/inferno/entities/test_session.rb', line 38 def initialize(params) super(params, ATTRIBUTES) self. ||= [] test_suite&.&.each do |option| if .none? { |selected_option| selected_option.id == option.id } << DSL::SuiteOption.new(id: option.id, value: option..first[:value]) end end end |
Instance Attribute Details
#created_at ⇒ Time
Returns creation timestamp.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/inferno/entities/test_session.rb', line 24 class TestSession < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_suite_id, :test_suite, :test_runs, :results, :suite_options ].freeze include Inferno::Entities::Attributes def initialize(params) super(params, ATTRIBUTES) self. ||= [] test_suite&.&.each do |option| if .none? { |selected_option| selected_option.id == option.id } << DSL::SuiteOption.new(id: option.id, value: option..first[:value]) end end end def test_suite @test_suite ||= Repositories::TestSuites.new.find(test_suite_id) end def to_hash session_hash = (self.class::ATTRIBUTES - [:suite_options]).each_with_object({}) do |attribute, hash| hash[attribute] = send(attribute) end session_hash[:suite_options] = &.map(&:to_hash) || [] session_hash.compact end def ( || []).each_with_object({}) do |option, hash| hash[option.id] = option.value end end end |
#id ⇒ String
Returns id of the session.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/inferno/entities/test_session.rb', line 24 class TestSession < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_suite_id, :test_suite, :test_runs, :results, :suite_options ].freeze include Inferno::Entities::Attributes def initialize(params) super(params, ATTRIBUTES) self. ||= [] test_suite&.&.each do |option| if .none? { |selected_option| selected_option.id == option.id } << DSL::SuiteOption.new(id: option.id, value: option..first[:value]) end end end def test_suite @test_suite ||= Repositories::TestSuites.new.find(test_suite_id) end def to_hash session_hash = (self.class::ATTRIBUTES - [:suite_options]).each_with_object({}) do |attribute, hash| hash[attribute] = send(attribute) end session_hash[:suite_options] = &.map(&:to_hash) || [] session_hash.compact end def ( || []).each_with_object({}) do |option, hash| hash[option.id] = option.value end end end |
#results ⇒ Array<Inferno::Entities::TestResult>
associated with this session
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/inferno/entities/test_session.rb', line 24 class TestSession < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_suite_id, :test_suite, :test_runs, :results, :suite_options ].freeze include Inferno::Entities::Attributes def initialize(params) super(params, ATTRIBUTES) self. ||= [] test_suite&.&.each do |option| if .none? { |selected_option| selected_option.id == option.id } << DSL::SuiteOption.new(id: option.id, value: option..first[:value]) end end end def test_suite @test_suite ||= Repositories::TestSuites.new.find(test_suite_id) end def to_hash session_hash = (self.class::ATTRIBUTES - [:suite_options]).each_with_object({}) do |attribute, hash| hash[attribute] = send(attribute) end session_hash[:suite_options] = &.map(&:to_hash) || [] session_hash.compact end def ( || []).each_with_object({}) do |option, hash| hash[option.id] = option.value end end end |
#suite_options ⇒ Hash
Returns the suite options associated with this session.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/inferno/entities/test_session.rb', line 24 class TestSession < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_suite_id, :test_suite, :test_runs, :results, :suite_options ].freeze include Inferno::Entities::Attributes def initialize(params) super(params, ATTRIBUTES) self. ||= [] test_suite&.&.each do |option| if .none? { |selected_option| selected_option.id == option.id } << DSL::SuiteOption.new(id: option.id, value: option..first[:value]) end end end def test_suite @test_suite ||= Repositories::TestSuites.new.find(test_suite_id) end def to_hash session_hash = (self.class::ATTRIBUTES - [:suite_options]).each_with_object({}) do |attribute, hash| hash[attribute] = send(attribute) end session_hash[:suite_options] = &.map(&:to_hash) || [] session_hash.compact end def ( || []).each_with_object({}) do |option, hash| hash[option.id] = option.value end end end |
#test_runs ⇒ Array<Inferno::Entities::TestRun>
with this session
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/inferno/entities/test_session.rb', line 24 class TestSession < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_suite_id, :test_suite, :test_runs, :results, :suite_options ].freeze include Inferno::Entities::Attributes def initialize(params) super(params, ATTRIBUTES) self. ||= [] test_suite&.&.each do |option| if .none? { |selected_option| selected_option.id == option.id } << DSL::SuiteOption.new(id: option.id, value: option..first[:value]) end end end def test_suite @test_suite ||= Repositories::TestSuites.new.find(test_suite_id) end def to_hash session_hash = (self.class::ATTRIBUTES - [:suite_options]).each_with_object({}) do |attribute, hash| hash[attribute] = send(attribute) end session_hash[:suite_options] = &.map(&:to_hash) || [] session_hash.compact end def ( || []).each_with_object({}) do |option, hash| hash[option.id] = option.value end end end |
#test_suite ⇒ Inferno::Entities::TestSuite
session
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/inferno/entities/test_session.rb', line 24 class TestSession < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_suite_id, :test_suite, :test_runs, :results, :suite_options ].freeze include Inferno::Entities::Attributes def initialize(params) super(params, ATTRIBUTES) self. ||= [] test_suite&.&.each do |option| if .none? { |selected_option| selected_option.id == option.id } << DSL::SuiteOption.new(id: option.id, value: option..first[:value]) end end end def test_suite @test_suite ||= Repositories::TestSuites.new.find(test_suite_id) end def to_hash session_hash = (self.class::ATTRIBUTES - [:suite_options]).each_with_object({}) do |attribute, hash| hash[attribute] = send(attribute) end session_hash[:suite_options] = &.map(&:to_hash) || [] session_hash.compact end def ( || []).each_with_object({}) do |option, hash| hash[option.id] = option.value end end end |
#test_suite_id ⇒ String
Returns id of the TestSuite
being run in this session.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/inferno/entities/test_session.rb', line 24 class TestSession < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_suite_id, :test_suite, :test_runs, :results, :suite_options ].freeze include Inferno::Entities::Attributes def initialize(params) super(params, ATTRIBUTES) self. ||= [] test_suite&.&.each do |option| if .none? { |selected_option| selected_option.id == option.id } << DSL::SuiteOption.new(id: option.id, value: option..first[:value]) end end end def test_suite @test_suite ||= Repositories::TestSuites.new.find(test_suite_id) end def to_hash session_hash = (self.class::ATTRIBUTES - [:suite_options]).each_with_object({}) do |attribute, hash| hash[attribute] = send(attribute) end session_hash[:suite_options] = &.map(&:to_hash) || [] session_hash.compact end def ( || []).each_with_object({}) do |option, hash| hash[option.id] = option.value end end end |
#updated_at ⇒ Time
Returns update timestamp.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/inferno/entities/test_session.rb', line 24 class TestSession < Entity ATTRIBUTES = [ :id, :created_at, :updated_at, :test_suite_id, :test_suite, :test_runs, :results, :suite_options ].freeze include Inferno::Entities::Attributes def initialize(params) super(params, ATTRIBUTES) self. ||= [] test_suite&.&.each do |option| if .none? { |selected_option| selected_option.id == option.id } << DSL::SuiteOption.new(id: option.id, value: option..first[:value]) end end end def test_suite @test_suite ||= Repositories::TestSuites.new.find(test_suite_id) end def to_hash session_hash = (self.class::ATTRIBUTES - [:suite_options]).each_with_object({}) do |attribute, hash| hash[attribute] = send(attribute) end session_hash[:suite_options] = &.map(&:to_hash) || [] session_hash.compact end def ( || []).each_with_object({}) do |option, hash| hash[option.id] = option.value end end end |
Instance Method Details
#suite_options_hash ⇒ Object
64 65 66 67 68 |
# File 'lib/inferno/entities/test_session.rb', line 64 def ( || []).each_with_object({}) do |option, hash| hash[option.id] = option.value end end |
#to_hash ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/inferno/entities/test_session.rb', line 54 def to_hash session_hash = (self.class::ATTRIBUTES - [:suite_options]).each_with_object({}) do |attribute, hash| hash[attribute] = send(attribute) end session_hash[:suite_options] = &.map(&:to_hash) || [] session_hash.compact end |