Class: Inferno::Entities::TestKit

Inherits:
Object
  • Object
show all
Defined in:
lib/inferno/entities/test_kit.rb

Overview

Examples:


module USCoreTestKit
  class TestKit < Inferno::Entities::TestKit
    id :us_core
    title 'US Core Test Kit'
    description <<~DESCRIPTION
      This is a big markdown description of the test kit.
    DESCRIPTION
    suite_ids ['us_core_v311', 'us_core_v400', 'us_core_v501', 'us_core_v610']
    tags ['SMART App Launch', 'US Core']
    last_updated '2024-03-07'
    version '0.6.4'
    maturity 'High'
    authors ['Author One', 'Author Two']
    repo 'https://github.com/inferno-framework/us-core-test-kit'
  end
end

Class Method Summary collapse

Class Method Details

.add_self_to_repositoryObject



153
154
155
# File 'lib/inferno/entities/test_kit.rb', line 153

def add_self_to_repository
  repository.insert(self)
end

.authors(new_authors = nil) ⇒ Array<String>

Set/get the list of authors for the test kit

Parameters:

  • new_authors (Array<String>) (defaults to: nil)

Returns:

  • (Array<String>)


127
128
129
130
131
# File 'lib/inferno/entities/test_kit.rb', line 127

def authors(new_authors = nil)
  return @authors if new_authors.nil?

  @authors = new_authors
end

.copy_instance_variablesObject



163
164
165
166
167
# File 'lib/inferno/entities/test_kit.rb', line 163

def copy_instance_variables
  instance_variables
    .reject { |variable| [:id].include? variable }
    .each { |variable| subclass.instance_variable_set(variable, instance_variable_get(variable).dup) }
end

.description(new_description = nil) ⇒ String

Set/get the description for the test kit

Parameters:

  • new_description (String) (defaults to: nil)

Returns:

  • (String)


57
58
59
60
61
# File 'lib/inferno/entities/test_kit.rb', line 57

def description(new_description = nil)
  return @description if new_description.nil?

  @description = new_description
end

.id(new_id = nil) ⇒ Symbol, String

Set/get the id for the test kit

Parameters:

  • new_id (Symbol, String) (defaults to: nil)

Returns:

  • (Symbol, String)


37
38
39
40
41
# File 'lib/inferno/entities/test_kit.rb', line 37

def id(new_id = nil)
  return @id if new_id.nil?

  @id = new_id
end

.inherited(inheriting_class) ⇒ Object



26
27
28
29
30
31
# File 'lib/inferno/entities/test_kit.rb', line 26

def inherited(inheriting_class)
  super
  inheriting_class.define_singleton_method(:inherited) do |subclass|
    copy_instance_variables(subclass)
  end
end

.last_updated(new_last_updated = nil) ⇒ String

Set/get the last updated date for the test kit

Parameters:

  • new_last_updated (String) (defaults to: nil)

Returns:

  • (String)


77
78
79
80
81
# File 'lib/inferno/entities/test_kit.rb', line 77

def last_updated(new_last_updated = nil)
  return @last_updated if new_last_updated.nil?

  @last_updated = new_last_updated
end

.maturity(new_maturity = nil) ⇒ String

Set/get the maturity level for the test kit

Parameters:

  • new_maturity (String) (defaults to: nil)

Returns:

  • (String)


97
98
99
100
101
# File 'lib/inferno/entities/test_kit.rb', line 97

def maturity(new_maturity = nil)
  return @maturity if new_maturity.nil?

  @maturity = new_maturity
end

.optionsHash{Symbol,String=>Array<Inferno::DSL::SuiteOption>}

Get the options for the suites in the test kit

Returns:



146
147
148
149
150
# File 'lib/inferno/entities/test_kit.rb', line 146

def options
  return @options if @options.present?

  @options = suites.each_with_object({}) { |suite, hash| hash[suite.id] = suite.suite_options }
end

.repo(new_repo = nil) ⇒ String

Set/get the code repository url for the test kit

Parameters:

  • new_repo (String) (defaults to: nil)

Returns:

  • (String)


117
118
119
120
121
# File 'lib/inferno/entities/test_kit.rb', line 117

def repo(new_repo = nil)
  return @repo if new_repo.nil?

  @repo = new_repo
end

.repositoryObject



158
159
160
# File 'lib/inferno/entities/test_kit.rb', line 158

def repository
  @repository ||= Inferno::Repositories::TestKits
end

.suite_ids(new_ids = nil) ⇒ Array<Symbol,String>

Set/get the suite ids for the test kit

Parameters:

  • new_ids (Array<Symbol,String>) (defaults to: nil)

Returns:

  • (Array<Symbol,String>)


107
108
109
110
111
# File 'lib/inferno/entities/test_kit.rb', line 107

def suite_ids(new_ids = nil)
  return @suite_ids || [] if new_ids.nil?

  @suite_ids = new_ids
end

.suitesArray<Inferno::Entities::TestSuite>

Get the suites whose ids are defined in ‘suite_ids`

Returns:



136
137
138
139
140
141
# File 'lib/inferno/entities/test_kit.rb', line 136

def suites
  return @suites if @suites.present?

  repo = Inferno::Repositories::TestSuites.new
  @suites = suite_ids.map { |id| repo.find(id) }
end

.tags(new_tags = nil) ⇒ Array<String>

Set/get the tags for the test kit

Parameters:

  • new_tags (Array<String>) (defaults to: nil)

Returns:

  • (Array<String>)


67
68
69
70
71
# File 'lib/inferno/entities/test_kit.rb', line 67

def tags(new_tags = nil)
  return @tags if new_tags.nil?

  @tags = new_tags
end

.title(new_title = nil) ⇒ String

Set/get the title for the test kit

Parameters:

  • new_title (String) (defaults to: nil)

Returns:

  • (String)


47
48
49
50
51
# File 'lib/inferno/entities/test_kit.rb', line 47

def title(new_title = nil)
  return @title if new_title.nil?

  @title = new_title
end

.version(new_version = nil) ⇒ String

Set/get the version for the test kit

Parameters:

  • new_version (String) (defaults to: nil)

Returns:

  • (String)


87
88
89
90
91
# File 'lib/inferno/entities/test_kit.rb', line 87

def version(new_version = nil)
  return @version if new_version.nil?

  @version = new_version
end