Class: Inferno::Entities::TestSuite

Inherits:
Object
  • Object
show all
Extended by:
Forwardable, DSL::FHIRClient::ClassMethods, DSL::HTTPClient::ClassMethods, DSL::Runnable
Includes:
DSL::FHIRResourceValidation, DSL::FHIRValidation
Defined in:
lib/inferno/entities/test_suite.rb

Overview

A TestSuite represents a packaged group of tests, usually for a single Implementation Guide

Instance Attribute Summary

Attributes included from DSL::Runnable

#parent, #suite_option_requirements

Class Method Summary collapse

Methods included from DSL::Runnable

description, id, input_instructions, optional, optional?, required, required?, required_suite_options, resume_test_route, route, short_description, short_title, title

Methods included from DSL::FHIRClient::ClassMethods

fhir_client

Methods included from DSL::HTTPClient::ClassMethods

http_client

Methods included from DSL::FHIRValidation

#find_validator, #resource_is_valid?

Class Method Details

.check_configuration(&block) ⇒ void

This method returns an undefined value.

Provide a block which will verify any configuration needed for this test suite to operate properly.

Yield Returns:

  • (Array<Hash>)

    An array of message hashes containing the keys :type and :message. Type options are info, warning, and error.



100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/inferno/entities/test_suite.rb', line 100

def check_configuration(&block)
  @check_configuration_block = lambda do
    block.call&.each do |configuration_message|
      case configuration_message[:type]
      when 'warning'
        Application[:logger].warn(configuration_message[:message])
      when 'error'
        Application[:logger].error(configuration_message[:message])
      end
    end
  end
end

.groupvoid

This method returns an undefined value.

Add a child group



50
51
52
53
# File 'lib/inferno/entities/test_suite.rb', line 50

def group(...)
  ()
  define_child(...)
end

.groups(options = nil) ⇒ Array<Inferno::Entities::TestGroup>

Get this suite’s child groups, filtered by suite options, if provided.

Parameters:

Returns:



42
43
44
# File 'lib/inferno/entities/test_suite.rb', line 42

def groups(options = nil)
  children(options).select { |child| child < Inferno::Entities::TestGroup }
end

Set/get a list of links which are displayed in the footer of the UI.

Examples:

links [
  {
    label: 'Report Issue',
    url: 'https://github.com/onc-healthit/onc-certification-g10-test-kit/issues/'
  },
  {
    label: 'Open Source',
    url: 'https://github.com/onc-healthit/onc-certification-g10-test-kit/'
  }
]

Parameters:

  • links (Array<Hash>) (defaults to: nil)

    A list of Hashes for the links to be displayed. Each hash needs a label: and url: entry.

Returns:

  • (Array<Hash>, nil)


179
180
181
182
183
# File 'lib/inferno/entities/test_suite.rb', line 179

def links(links = nil)
  return @links if links.nil?

  @links = links
end

.suite_option(identifier, **option_params) ⇒ void

This method returns an undefined value.

Define an option for this suite. Options are used to define suite-wide configuration which is selected by a user at the start of a test session. These options can be used to change what tests/groups are run or behavior within particular tests.

Examples:

suite_option :ig_version,
            list_options: [
              {
                label: 'IG v1',
                value: 'ig_v1'
              },
              {
                label: 'IG v2',
                value: 'ig_v2'
              }
            ]

group from: :ig_v1_group,
      required_suite_options: { ig_version: 'ig_v1' }

group from: :ig_v2_group do
  required_suite_options ig_version: 'ig_v2'
end

Parameters:

  • identifier (Symbol, String)

    The identifier which will be used to refer to this option

  • option_params (Hash)

    a customizable set of options

Options Hash (**option_params):

  • :title (String)

    Title which will be displayed in the UI

  • :list_options (Array<Hash>)

    The list of possible values for this option. Each hash needs to have a label: and a value: entry which are Strings.



151
152
153
# File 'lib/inferno/entities/test_suite.rb', line 151

def suite_option(identifier, **option_params)
  suite_options << DSL::SuiteOption.new(option_params.merge(id: identifier))
end

.suite_optionsArray<Inferno::DSL::SuiteOption>

Returns The options defined for this suite.

Returns:



157
158
159
# File 'lib/inferno/entities/test_suite.rb', line 157

def suite_options
  @suite_options ||= []
end

.suite_summary(suite_summary = nil) ⇒ String?

Set/get a description which for this test suite which will be displayed in the UI.

Parameters:

  • suite_summary (String) (defaults to: nil)

Returns:

  • (String, nil)


191
192
193
194
195
# File 'lib/inferno/entities/test_suite.rb', line 191

def suite_summary(suite_summary = nil)
  return @suite_summary if suite_summary.nil?

  @suite_summary = format_markdown(suite_summary)
end

.version(version = nil) ⇒ String?

Set/get the version of this test suite.

Parameters:

  • version (String) (defaults to: nil)

Returns:

  • (String, nil)


75
76
77
78
79
# File 'lib/inferno/entities/test_suite.rb', line 75

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

  @version = version
end