Class: Inferno::Entities::TestGroup
- Inherits:
-
Object
- Object
- Inferno::Entities::TestGroup
- Extended by:
- Forwardable, DSL::FHIRClient::ClassMethods, DSL::HTTPClient::ClassMethods, DSL::Runnable
- Includes:
- DSL::FHIRValidation
- Defined in:
- lib/inferno/entities/test_group.rb
Constant Summary
Constants included from DSL::Runnable
DSL::Runnable::VARIABLES_NOT_TO_COPY
Instance Attribute Summary
Attributes included from DSL::Runnable
#parent, #suite_option_requirements
Class Method Summary collapse
- .default_id ⇒ Object
-
.group ⇒ void
Add a child group.
- .group_metadata ⇒ Object
-
.groups(options = nil) ⇒ Array<Inferno::Entities::TestGroup>
Get this group’s child groups, filtered by suite options, if provided.
- .reference_hash ⇒ Object
- .repository ⇒ Object
-
.run_as_group(value = true) ⇒ void
When true, this group’s children can not be run individually in the UI, and this group must be run as a group.
- .run_as_group? ⇒ Boolean
-
.short_id ⇒ String
A short numeric id which is displayed in the UI.
-
.test ⇒ void
Add a test.
- .test_metadata ⇒ Object
-
.tests(options = nil) ⇒ Array<Inferno::Entities::Test>
Get this group’s child tests, filtered by suite options, if provided.
Instance Method Summary collapse
- #method_missing(name, *args) ⇒ Object
- #respond_to_missing?(name, _include_private = false) ⇒ Boolean
Methods included from DSL::FHIRClient::ClassMethods
fhir_client, fhir_client_definitions
Methods included from DSL::HTTPClient::ClassMethods
http_client, http_client_definitions
Methods included from DSL::Runnable
add_self_to_repository, all_children, child_metadata, children, configure_child_class, copy_instance_variables, create_child_class, default_id, define_child, description, extended, handle_child_definition_block, id, input_instructions, inspect, optional, optional?, process_args, repository, required, required?, required_suite_options, resume_test_route, route, short_description, short_title, suite, suite_endpoint, test_count, title, user_runnable?
Methods included from Utils::MarkdownFormatter
Methods included from DSL::FHIRValidation
#find_validator, included, #resource_is_valid?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/inferno/entities/test_group.rb', line 16 def method_missing(name, *args, &) parent_instance = self.class.parent&.new if parent_instance.respond_to?(name) parent_instance.send(name, *args, &) else super end end |
Class Method Details
.default_id ⇒ Object
96 97 98 99 100 101 |
# File 'lib/inferno/entities/test_group.rb', line 96 def default_id return name if name.present? suffix = parent ? (parent.groups.find_index(self) + 1).to_s.rjust(2, '0') : SecureRandom.uuid "Group#{suffix}" end |
.group ⇒ void
This method returns an undefined value.
Add a child group
58 59 60 61 |
# File 'lib/inferno/entities/test_group.rb', line 58 def group(...) () define_child(...) end |
.group_metadata ⇒ Object
71 72 73 74 75 76 |
# File 'lib/inferno/entities/test_group.rb', line 71 def { class: TestGroup, repo: repository } end |
.groups(options = nil) ⇒ Array<Inferno::Entities::TestGroup>
Get this group’s child groups, filtered by suite options, if provided.
41 42 43 |
# File 'lib/inferno/entities/test_group.rb', line 41 def groups( = nil) children().select { |child| child < Inferno::Entities::TestGroup } end |
.reference_hash ⇒ Object
104 105 106 107 108 |
# File 'lib/inferno/entities/test_group.rb', line 104 def reference_hash { test_group_id: id } end |
.repository ⇒ Object
32 33 34 |
# File 'lib/inferno/entities/test_group.rb', line 32 def repository Inferno::Repositories::TestGroups.new end |
.run_as_group(value = true) ⇒ void
This method returns an undefined value.
When true, this group’s children can not be run individually in the UI, and this group must be run as a group.
115 116 117 |
# File 'lib/inferno/entities/test_group.rb', line 115 def run_as_group(value = true) # rubocop:disable Style/OptionalBooleanParameter @run_as_group = value end |
.run_as_group? ⇒ Boolean
120 121 122 |
# File 'lib/inferno/entities/test_group.rb', line 120 def run_as_group? @run_as_group || false end |
.short_id ⇒ String
Returns A short numeric id which is displayed in the UI.
87 88 89 90 91 92 93 |
# File 'lib/inferno/entities/test_group.rb', line 87 def short_id @short_id ||= begin prefix = parent.respond_to?(:short_id) ? "#{parent.short_id}." : '' suffix = parent ? (parent.groups.find_index(self) + 1).to_s : 'X' "#{prefix}#{suffix}" end end |
.test ⇒ void
This method returns an undefined value.
Add a test
65 66 67 68 |
# File 'lib/inferno/entities/test_group.rb', line 65 def test(...) () define_child(...) end |
.test_metadata ⇒ Object
79 80 81 82 83 84 |
# File 'lib/inferno/entities/test_group.rb', line 79 def { class: Test, repo: Inferno::Repositories::Tests.new } end |
.tests(options = nil) ⇒ Array<Inferno::Entities::Test>
Get this group’s child tests, filtered by suite options, if provided.
50 51 52 |
# File 'lib/inferno/entities/test_group.rb', line 50 def tests( = nil) children().select { |child| child < Inferno::Entities::Test } end |
Instance Method Details
#respond_to_missing?(name, _include_private = false) ⇒ Boolean
26 27 28 |
# File 'lib/inferno/entities/test_group.rb', line 26 def respond_to_missing?(name, _include_private = false) self.class.parent&.new&.respond_to?(name) end |