inferno_core 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/inferno/dsl/assertions.rb +10 -0
- data/lib/inferno/dsl/configurable.rb +107 -2
- data/lib/inferno/dsl/fhir_client.rb +21 -8
- data/lib/inferno/dsl/fhir_client_builder.rb +16 -0
- data/lib/inferno/dsl/http_client.rb +1 -1
- data/lib/inferno/dsl/oauth_credentials.rb +22 -8
- data/lib/inferno/dsl/request_storage.rb +2 -2
- data/lib/inferno/dsl/results.rb +2 -0
- data/lib/inferno/dsl/runnable.rb +34 -6
- data/lib/inferno/dsl/suite_option.rb +14 -0
- data/lib/inferno/dsl/tcp_exception_handler.rb +1 -0
- data/lib/inferno/entities/attributes.rb +1 -0
- data/lib/inferno/entities/request.rb +4 -2
- data/lib/inferno/entities/test.rb +1 -1
- data/lib/inferno/entities/test_group.rb +24 -0
- data/lib/inferno/entities/test_suite.rb +76 -2
- data/lib/inferno/public/bundle.js +12 -12
- data/lib/inferno/version.rb +1 -1
- metadata +4 -4
@@ -13,6 +13,7 @@ module Inferno
|
|
13
13
|
|
14
14
|
def_delegators 'self.class', :title, :id, :groups, :inputs, :outputs, :tests
|
15
15
|
|
16
|
+
# @private
|
16
17
|
def method_missing(name, *args, &)
|
17
18
|
parent_instance = self.class.parent&.new
|
18
19
|
if parent_instance.respond_to?(name)
|
@@ -22,6 +23,7 @@ module Inferno
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
26
|
+
# @private
|
25
27
|
def respond_to_missing?(name, _include_private = false)
|
26
28
|
self.class.parent&.new&.respond_to?(name)
|
27
29
|
end
|
@@ -31,26 +33,39 @@ module Inferno
|
|
31
33
|
Inferno::Repositories::TestGroups.new
|
32
34
|
end
|
33
35
|
|
36
|
+
# Get this group's child groups, filtered by suite options, if provided.
|
37
|
+
#
|
38
|
+
# @param options [Array<Inferno::DSL::SuiteOption>]
|
39
|
+
#
|
40
|
+
# @return [Array<Inferno::Entities::TestGroup>]
|
34
41
|
def groups(options = nil)
|
35
42
|
children(options).select { |child| child < Inferno::Entities::TestGroup }
|
36
43
|
end
|
37
44
|
|
45
|
+
# Get this group's child tests, filtered by suite options, if provided.
|
46
|
+
#
|
47
|
+
# @param options [Array<Inferno::DSL::SuiteOption>]
|
48
|
+
#
|
49
|
+
# @return [Array<Inferno::Entities::Test>]
|
38
50
|
def tests(options = nil)
|
39
51
|
children(options).select { |child| child < Inferno::Entities::Test }
|
40
52
|
end
|
41
53
|
|
42
54
|
# Methods to configure Inferno::DSL::Runnable
|
43
55
|
|
56
|
+
# Add a child group
|
44
57
|
def group(...)
|
45
58
|
child_metadata(group_metadata)
|
46
59
|
define_child(...)
|
47
60
|
end
|
48
61
|
|
62
|
+
# Add a test
|
49
63
|
def test(...)
|
50
64
|
child_metadata(test_metadata)
|
51
65
|
define_child(...)
|
52
66
|
end
|
53
67
|
|
68
|
+
# @private
|
54
69
|
def group_metadata
|
55
70
|
{
|
56
71
|
class: TestGroup,
|
@@ -58,6 +73,7 @@ module Inferno
|
|
58
73
|
}
|
59
74
|
end
|
60
75
|
|
76
|
+
# @private
|
61
77
|
def test_metadata
|
62
78
|
{
|
63
79
|
class: Test,
|
@@ -65,6 +81,7 @@ module Inferno
|
|
65
81
|
}
|
66
82
|
end
|
67
83
|
|
84
|
+
# @return [String] A short numeric id which is displayed in the UI
|
68
85
|
def short_id
|
69
86
|
@short_id ||= begin
|
70
87
|
prefix = parent.respond_to?(:short_id) ? "#{parent.short_id}." : ''
|
@@ -73,6 +90,7 @@ module Inferno
|
|
73
90
|
end
|
74
91
|
end
|
75
92
|
|
93
|
+
# @private
|
76
94
|
def default_id
|
77
95
|
return name if name.present?
|
78
96
|
|
@@ -80,16 +98,22 @@ module Inferno
|
|
80
98
|
"Group#{suffix}"
|
81
99
|
end
|
82
100
|
|
101
|
+
# @private
|
83
102
|
def reference_hash
|
84
103
|
{
|
85
104
|
test_group_id: id
|
86
105
|
}
|
87
106
|
end
|
88
107
|
|
108
|
+
# When true, this group's children can not be run individually in the
|
109
|
+
# UI, and this group must be run as a group.
|
110
|
+
#
|
111
|
+
# @param value [Boolean]
|
89
112
|
def run_as_group(value = true) # rubocop:disable Style/OptionalBooleanParameter
|
90
113
|
@run_as_group = value
|
91
114
|
end
|
92
115
|
|
116
|
+
# @return [Boolean]
|
93
117
|
def run_as_group?
|
94
118
|
@run_as_group || false
|
95
119
|
end
|
@@ -19,6 +19,7 @@ module Inferno
|
|
19
19
|
|
20
20
|
def_delegator :default_group, :test
|
21
21
|
|
22
|
+
# @private
|
22
23
|
def default_group
|
23
24
|
return @default_group if @default_group
|
24
25
|
|
@@ -31,17 +32,24 @@ module Inferno
|
|
31
32
|
Inferno::Repositories::TestSuites.new
|
32
33
|
end
|
33
34
|
|
35
|
+
# Get this suite's child groups, filtered by suite options, if provided.
|
36
|
+
#
|
37
|
+
# @param options [Array<Inferno::DSL::SuiteOption>]
|
38
|
+
#
|
39
|
+
# @return [Array<Inferno::Entities::TestGroup>]
|
34
40
|
def groups(options = nil)
|
35
41
|
children(options).select { |child| child < Inferno::Entities::TestGroup }
|
36
42
|
end
|
37
43
|
|
38
44
|
# Methods to configure Inferno::DSL::Runnable
|
39
45
|
|
46
|
+
# Add a child group
|
40
47
|
def group(...)
|
41
48
|
child_metadata(group_metadata)
|
42
49
|
define_child(...)
|
43
50
|
end
|
44
51
|
|
52
|
+
# @private
|
45
53
|
def group_metadata
|
46
54
|
{
|
47
55
|
class: TestGroup,
|
@@ -49,18 +57,25 @@ module Inferno
|
|
49
57
|
}
|
50
58
|
end
|
51
59
|
|
60
|
+
# @private
|
52
61
|
def reference_hash
|
53
62
|
{
|
54
63
|
test_suite_id: id
|
55
64
|
}
|
56
65
|
end
|
57
66
|
|
67
|
+
# Set/get the version of this test suite.
|
68
|
+
#
|
69
|
+
# @param version [String]
|
70
|
+
#
|
71
|
+
# @return [String, nil]
|
58
72
|
def version(version = nil)
|
59
73
|
return @version if version.nil?
|
60
74
|
|
61
75
|
@version = version
|
62
76
|
end
|
63
77
|
|
78
|
+
# @private
|
64
79
|
def configuration_messages(new_messages = nil, force_recheck: false)
|
65
80
|
return @configuration_messages = new_messages unless new_messages.nil?
|
66
81
|
|
@@ -82,24 +97,83 @@ module Inferno
|
|
82
97
|
@check_configuration_block = block
|
83
98
|
end
|
84
99
|
|
100
|
+
# @private
|
85
101
|
def presets
|
86
102
|
@presets ||= Repositories::Presets.new.presets_for_suite(id)
|
87
103
|
end
|
88
104
|
|
89
|
-
|
90
|
-
|
105
|
+
# Define an option for this suite. Options are used to define suite-wide
|
106
|
+
# configuration which is selected by a user at the start of a test
|
107
|
+
# session. These options can be used to change what tests/groups are run
|
108
|
+
# or behavior within particular tests.
|
109
|
+
#
|
110
|
+
# @param identifier [Symbol, String] The identifier which will be used
|
111
|
+
# to refer to this option
|
112
|
+
# @option option_params [String] :title Title which will be displayed in
|
113
|
+
# the UI
|
114
|
+
# @option option_params [Array<Hash>] :list_options The list of possible
|
115
|
+
# values for this option. Each hash needs to have a `label:` and a
|
116
|
+
# `value:` entry which are Strings.
|
117
|
+
#
|
118
|
+
# @example
|
119
|
+
# suite_option :ig_version,
|
120
|
+
# list_options: [
|
121
|
+
# {
|
122
|
+
# label: 'IG v1',
|
123
|
+
# value: 'ig_v1'
|
124
|
+
# },
|
125
|
+
# {
|
126
|
+
# label: 'IG v2',
|
127
|
+
# value: 'ig_v2'
|
128
|
+
# }
|
129
|
+
# ]
|
130
|
+
#
|
131
|
+
# group from: :ig_v1_group,
|
132
|
+
# required_suite_options: { ig_version: 'ig_v1' }
|
133
|
+
#
|
134
|
+
# group from: :ig_v2_group do
|
135
|
+
# required_suite_options ig_version: 'ig_v2'
|
136
|
+
# end
|
137
|
+
def suite_option(identifier, **option_params)
|
138
|
+
suite_options << DSL::SuiteOption.new(option_params.merge(id: identifier))
|
91
139
|
end
|
92
140
|
|
141
|
+
# @return [Array<Inferno::DSL::SuiteOption>] The options defined for
|
142
|
+
# this suite
|
93
143
|
def suite_options
|
94
144
|
@suite_options ||= []
|
95
145
|
end
|
96
146
|
|
147
|
+
# Set/get a list of links which are displayed in the footer of the UI.
|
148
|
+
#
|
149
|
+
# @param links [Array<Hash>] A list of Hashes for the links to be
|
150
|
+
# displayed. Each hash needs a `label:` and `url:` entry.
|
151
|
+
#
|
152
|
+
# @return [Array<Hash>, nil]
|
153
|
+
#
|
154
|
+
# @example
|
155
|
+
# links [
|
156
|
+
# {
|
157
|
+
# label: 'Report Issue',
|
158
|
+
# url: 'https://github.com/onc-healthit/onc-certification-g10-test-kit/issues/'
|
159
|
+
# },
|
160
|
+
# {
|
161
|
+
# label: 'Open Source',
|
162
|
+
# url: 'https://github.com/onc-healthit/onc-certification-g10-test-kit/'
|
163
|
+
# }
|
164
|
+
# ]
|
97
165
|
def links(links = nil)
|
98
166
|
return @links if links.nil?
|
99
167
|
|
100
168
|
@links = links
|
101
169
|
end
|
102
170
|
|
171
|
+
# Set/get a description which for this test suite which will be
|
172
|
+
# displayed in the UI.
|
173
|
+
#
|
174
|
+
# @param suite_summary [String]
|
175
|
+
#
|
176
|
+
# @return [String, nil]
|
103
177
|
def suite_summary(suite_summary = nil)
|
104
178
|
return @suite_summary if suite_summary.nil?
|
105
179
|
|