qat-reporter 6.1.1 → 6.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aff09985c21836c062c08f0b76b62e6db193fe4217083ce76aaca9da5225eb72
4
- data.tar.gz: 0fa22c9f40ff66cee9f2129c14efce9f8a8e62d875978900b4746866d016ea2e
3
+ metadata.gz: db3a0b385f5f2834c14451dc31112a19c3d0a47618ae568c725a79e921d0c1f6
4
+ data.tar.gz: b99572aa94b48fb9d1db55fce074cbb3860d0fa437d1ce4c8e05bff285a242fa
5
5
  SHA512:
6
- metadata.gz: a9f09816f53cabb02a0b498a8098b6892b8edd7933d42664ff740f694d51a98fcaa6d0936cf763cb2762cb254f56801fda964d1979c2367685d8caa339b797c1
7
- data.tar.gz: f479e89276f78ae1bd998afafb0cbcbce3ce27e7eb482de7f2b9a5b0bd157d731842c3628efee8e1ae5a62acfa75e15dbb1b0b57aca690b17c9c1c60fc5c2628
6
+ metadata.gz: 661ca8679e1d424c8f7a72c07ac6aebf3402fac2d49deaa84b2dbc5fd365ea60cb0a788f9ee063c138016a3284fc5325203ab3533ac3a61296d6e3575903d4e7
7
+ data.tar.gz: 60ec0c6498f8d64380595e93d9220a0e81614af962429e296f6bfbaa7f74fe9f8ee2059004005d7115dd471866b71793fc7015122cc0adc5064f1bceb0dd3c8f
@@ -40,7 +40,7 @@ module QAT
40
40
  name: [],
41
41
  tags: [],
42
42
  timestamp: [],
43
- test_run: []
43
+ test_runs: []
44
44
  }
45
45
  end
46
46
 
@@ -73,7 +73,7 @@ module QAT
73
73
  name: @current_scenario,
74
74
  tags: [],
75
75
  timestamp: @current_scenario_timestamp,
76
- test_run: []
76
+ test_runs: []
77
77
  }
78
78
  end
79
79
  end
@@ -85,7 +85,7 @@ module QAT
85
85
  name: @current_scenario,
86
86
  tags: [],
87
87
  timestamp: @current_scenario_timestamp,
88
- test_run: []
88
+ test_runs: []
89
89
  }
90
90
  end
91
91
 
@@ -102,36 +102,37 @@ module QAT
102
102
  measurements = []
103
103
  end
104
104
 
105
+ test_run_info = {
106
+ id: test_run_id,
107
+ timestamp: Time.now.strftime("%FT%T%z"),
108
+ measurements: []
109
+ }
110
+
105
111
  unless measurements == [] || measurements == {}
106
112
  measurements.each do |id, measure|
107
113
  @measurement_id = id
108
114
  @measurement_name = measure[:name]
109
- end
110
115
 
111
- unless @measurement_id.nil?
112
- test_run_info = {
113
- id: test_run_id,
114
- timestamp: Time.now.strftime("%FT%T%z"),
115
- measurements: [
116
- {
117
- id: @measurement_id,
118
- name: @measurement_name,
119
- timestamp: Time.now.strftime("%FT%T%z"),
120
- time: {
121
- secs: duration,
122
- human: human_duration
123
- }
124
- }
125
- ]
126
- }
127
-
128
- if @current_scenario.is_a?(::Cucumber::Core::Ast::ScenarioOutline)
129
- @outline_scenario_info[:test_run] << test_run_info
130
- else
131
- @current_scenario_info[:test_run] << test_run_info
116
+ unless @measurement_id.nil?
117
+ measurements = {
118
+ id: @measurement_id,
119
+ name: @measurement_name,
120
+ timestamp: Time.now.strftime("%FT%T%z"),
121
+ time: {
122
+ secs: duration,
123
+ human: human_duration
124
+ }
125
+ }
126
+
127
+ test_run_info[:measurements] << measurements
132
128
  end
133
129
  end
134
130
  end
131
+ if @current_scenario.is_a?(::Cucumber::Core::Ast::ScenarioOutline)
132
+ @outline_scenario_info[:test_runs] << test_run_info
133
+ else
134
+ @current_scenario_info[:test_runs] << test_run_info
135
+ end
135
136
  end
136
137
 
137
138
  #@api private
@@ -156,15 +157,31 @@ module QAT
156
157
  #@api private
157
158
  def after_feature(*_)
158
159
  @indexes = []
160
+ @indexes_test_runs = []
159
161
  @scenarios = @current_feature_info[:scenarios]
162
+
160
163
  @scenarios.each_with_index do |key, value|
161
- if key[:test_run].empty?
162
- @indexes << value
164
+ test_run = key[:test_runs]
165
+ #Verifies if exist measures in a test_run
166
+ test_run.each_with_index do |key, value|
167
+ if key[:measurements].empty?
168
+ @indexes << value
169
+ end
170
+ end
171
+ #Deletes the empty measures
172
+ @indexes.reverse!.each do |v|
173
+ test_run.delete_at(v)
174
+ end
175
+ #Verifies if exist test_runs in a scenarios
176
+ if key[:test_runs].empty?
177
+ @indexes_test_runs << value
163
178
  end
164
179
  end
165
- @indexes.reverse!.each do |v|
180
+ #Delete empty test runs:
181
+ @indexes_test_runs.reverse!.each do |v|
166
182
  @current_feature_info[:scenarios].delete_at(v)
167
183
  end
184
+
168
185
  @json_content << @current_feature_info unless @scenarios.empty?
169
186
  end
170
187
 
@@ -175,6 +192,11 @@ module QAT
175
192
 
176
193
  private
177
194
 
195
+ def format_duration(seconds)
196
+ m, s = seconds.divmod(60)
197
+ "#{m}m #{'%.f' % s}s"
198
+ end
199
+
178
200
  # Writes results to a JSON file
179
201
  def publish_result
180
202
  @io.puts(JSON.pretty_generate(@json_content))
@@ -3,6 +3,6 @@ module QAT
3
3
  # Namespace for QAT Reporter
4
4
  module Reporter
5
5
  # Represents QAT Reporter's version
6
- VERSION = '6.1.1'
6
+ VERSION = '6.1.2'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qat-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.1
4
+ version: 6.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - QAT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-04 00:00:00.000000000 Z
11
+ date: 2019-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: qat-cucumber