Class: Inferno::Entities::TestSuite
- Inherits:
-
Object
- Object
- Inferno::Entities::TestSuite
- Extended by:
- Forwardable, DSL::FHIRClient::ClassMethods, DSL::HTTPClient::ClassMethods, DSL::Links, DSL::Runnable, DSL::ShortIDManager, DSL::SuiteRequirements
- Includes:
- DSL::Assertions, DSL::FHIRResourceValidation, DSL::FHIRValidation, DSL::FhirpathEvaluation, DSL::Messages, DSL::Results
- Defined in:
- lib/inferno/entities/test_suite.rb
Overview
A ‘TestSuite` represents a packaged group of tests, usually for a single Implementation Guide
Constant Summary
Constants included from DSL::Runnable
DSL::Runnable::VARIABLES_NOT_TO_COPY
Constants included from DSL::Links
Instance Attribute Summary collapse
-
#result_message ⇒ Object
Returns the value of attribute result_message.
-
#results ⇒ Object
Returns the value of attribute results.
Attributes included from DSL::Runnable
#parent, #suite_option_requirements
Class Method Summary collapse
-
.check_configuration(&block) ⇒ void
Provide a block which will verify any configuration needed for this test suite to operate properly.
- .configuration_messages(new_messages = nil, force_recheck: false) ⇒ Object
- .default_group ⇒ Object
-
.group ⇒ void
Add a child group.
- .group_metadata ⇒ Object
-
.groups(options = nil) ⇒ Array<Inferno::Entities::TestGroup>
Get this suite’s child groups, filtered by suite options, if provided.
- .presets ⇒ Object
- .reference_hash ⇒ Object
- .repository ⇒ Object
-
.suite_option(identifier, **option_params) ⇒ void
Define an option for this suite.
-
.suite_options ⇒ Array<Inferno::DSL::SuiteOption>
The options defined for this suite.
-
.suite_summary(suite_summary = nil) ⇒ String?
Set/get a description which for this test suite which will be displayed in the UI.
-
.test_kit ⇒ Inferno::Entities::TestKit
Get the TestKit this suite belongs to.
-
.version(version = nil) ⇒ String?
Set/get the version of this test suite.
Instance Method Summary collapse
-
#initialize ⇒ TestSuite
constructor
A new instance of TestSuite.
Methods included from DSL::Runnable
add_self_to_repository, all_children, all_descendants, all_verified_requirements, block, child_metadata, children, configure_child_class, copy_instance_variables, create_child_class, database_id, deep_dup, default_id, define_child, description, extended, handle_child_definition_block, id, input_instructions, inspect, optional, optional?, process_args, remove, remove_self_from_repository, reorder, replace, repository, required, required?, required_suite_options, resume_test_route, route, short_description, short_title, suite, suite_endpoint, test_count, title, user_runnable?, verifies_requirements
Methods included from Utils::MarkdownFormatter
Methods included from DSL::Links
add_link, add_predefined_link, download_url, ig_url, links, report_issue_url, source_code_url
Methods included from DSL::FHIRClient::ClassMethods
fhir_client, fhir_client_definitions, find_fhir_client_definition
Methods included from DSL::HTTPClient::ClassMethods
find_http_client_definition, http_client, http_client_definitions
Methods included from DSL::SuiteRequirements
Methods included from DSL::ShortIDManager
assign_short_ids, base_short_id_file_folder, current_short_id_map, short_id_file_name, short_id_file_path, short_id_map
Methods included from DSL::Messages
#add_message, #info, #messages, #warning
Methods included from DSL::Assertions
#assert, #assert_must_support_elements_present, #assert_resource_type, #assert_response_content_type, #assert_response_status, #assert_valid_bundle_entries, #assert_valid_http_uri, #assert_valid_json, #assert_valid_resource, #bad_content_type_message, #bad_resource_type_message, #bad_response_status_message, #invalid_bundle_entries_message, #invalid_resource_message, #missing_must_support_elements_message, #no_content_type_message, #normalize_resource_type, #normalize_types_to_check
Methods included from DSL::Results
#cancel, #identifier, #omit, #omit_if, #pass, #pass_if, #skip, #skip_if, #wait, #wait_timeout
Methods included from DSL::FhirpathEvaluation
Methods included from DSL::FHIRResourceValidation
#find_ig_and_profile, included
Methods included from DSL::FHIRValidation
#find_validator, included, #resource_is_valid?
Constructor Details
#initialize ⇒ TestSuite
Returns a new instance of TestSuite.
35 36 37 |
# File 'lib/inferno/entities/test_suite.rb', line 35 def initialize @results = Inferno::DSL::ResultCollection.new end |
Instance Attribute Details
#result_message ⇒ Object
Returns the value of attribute result_message.
32 33 34 |
# File 'lib/inferno/entities/test_suite.rb', line 32 def end |
#results ⇒ Object
Returns the value of attribute results.
32 33 34 |
# File 'lib/inferno/entities/test_suite.rb', line 32 def results @results end |
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.
122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/inferno/entities/test_suite.rb', line 122 def check_configuration(&block) @check_configuration_block = lambda do block.call&.each do || case [:type] when 'warning' Application[:logger].warn([:message]) when 'error' Application[:logger].error([:message]) end end end end |
.configuration_messages(new_messages = nil, force_recheck: false) ⇒ Object
104 105 106 107 108 109 110 111 112 113 |
# File 'lib/inferno/entities/test_suite.rb', line 104 def ( = nil, force_recheck: false) return = unless .nil? = if force_recheck @check_configuration_block ? @check_configuration_block.call : [] else || (@check_configuration_block ? @check_configuration_block.call : []) end end |
.default_group ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/inferno/entities/test_suite.rb', line 45 def default_group return @default_group if @default_group @default_group = Class.new(TestGroup) all_children << @default_group @default_group end |
.group ⇒ void
This method returns an undefined value.
Add a child group
71 72 73 74 |
# File 'lib/inferno/entities/test_suite.rb', line 71 def group(...) () define_child(...) end |
.group_metadata ⇒ Object
77 78 79 80 81 82 |
# File 'lib/inferno/entities/test_suite.rb', line 77 def { class: TestGroup, repo: Inferno::Repositories::TestGroups.new } end |
.groups(options = nil) ⇒ Array<Inferno::Entities::TestGroup>
Get this suite’s child groups, filtered by suite options, if provided.
63 64 65 |
# File 'lib/inferno/entities/test_suite.rb', line 63 def groups( = nil) children().select { |child| child < Inferno::Entities::TestGroup } end |
.presets ⇒ Object
136 137 138 |
# File 'lib/inferno/entities/test_suite.rb', line 136 def presets @presets ||= Repositories::Presets.new.presets_for_suite(id) end |
.reference_hash ⇒ Object
85 86 87 88 89 |
# File 'lib/inferno/entities/test_suite.rb', line 85 def reference_hash { test_suite_id: id } end |
.repository ⇒ Object
54 55 56 |
# File 'lib/inferno/entities/test_suite.rb', line 54 def repository Inferno::Repositories::TestSuites.new 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.
173 174 175 |
# File 'lib/inferno/entities/test_suite.rb', line 173 def suite_option(identifier, **option_params) << DSL::SuiteOption.new(option_params.merge(id: identifier)) end |
.suite_options ⇒ Array<Inferno::DSL::SuiteOption>
Returns The options defined for this suite.
179 180 181 |
# File 'lib/inferno/entities/test_suite.rb', line 179 def ||= [] end |
.suite_summary(suite_summary = nil) ⇒ String?
Set/get a description which for this test suite which will be displayed in the UI.
189 190 191 192 193 |
# File 'lib/inferno/entities/test_suite.rb', line 189 def suite_summary(suite_summary = nil) return @suite_summary if suite_summary.nil? @suite_summary = format_markdown(suite_summary) end |
.test_kit ⇒ Inferno::Entities::TestKit
Get the TestKit this suite belongs to
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/inferno/entities/test_suite.rb', line 198 def test_kit return @test_kit if @test_kit module_name = name while module_name.present? && @test_kit.nil? module_name = module_name.deconstantize next unless const_defined?("#{module_name}::Metadata") @test_kit = const_get("#{module_name}::Metadata") end @test_kit end |
.version(version = nil) ⇒ String?
Set/get the version of this test suite. Defaults to the TestKit version.
97 98 99 100 101 |
# File 'lib/inferno/entities/test_suite.rb', line 97 def version(version = nil) @version = version if version.present? @version || test_kit&.version end |