qat-reporter 6.1.0 → 6.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qat/formatter/time_measurements.rb +111 -62
- data/lib/qat/reporter/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aff09985c21836c062c08f0b76b62e6db193fe4217083ce76aaca9da5225eb72
|
4
|
+
data.tar.gz: 0fa22c9f40ff66cee9f2129c14efce9f8a8e62d875978900b4746866d016ea2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9f09816f53cabb02a0b498a8098b6892b8edd7933d42664ff740f694d51a98fcaa6d0936cf763cb2762cb254f56801fda964d1979c2367685d8caa339b797c1
|
7
|
+
data.tar.gz: f479e89276f78ae1bd998afafb0cbcbce3ce27e7eb482de7f2b9a5b0bd157d731842c3628efee8e1ae5a62acfa75e15dbb1b0b57aca690b17c9c1c60fc5c2628
|
@@ -3,7 +3,6 @@ require 'cucumber/formatter/io'
|
|
3
3
|
require 'cucumber/formatter/duration'
|
4
4
|
require 'cucumber/formatter/duration_extractor'
|
5
5
|
require 'json'
|
6
|
-
require 'fileutils'
|
7
6
|
require 'qat/logger'
|
8
7
|
require 'qat/formatter/loggable'
|
9
8
|
require_relative '../../qat/reporter/times'
|
@@ -13,29 +12,36 @@ module QAT
|
|
13
12
|
#@since 0.1.0
|
14
13
|
module Formatter
|
15
14
|
# Namespace for Time Measurements formatter
|
16
|
-
#@since
|
15
|
+
#@since 6.2.0
|
17
16
|
class TimeMeasurements
|
18
17
|
include ::Cucumber::Formatter::Io
|
19
18
|
include ::Cucumber::Formatter::Duration
|
20
|
-
include QAT::Formatter::Loggable
|
21
|
-
include QAT::Logger
|
22
19
|
|
23
|
-
#@api private
|
24
20
|
def initialize(runtime, path_or_io, options)
|
25
|
-
@io
|
26
|
-
@options
|
27
|
-
@
|
28
|
-
|
29
|
-
# ensure_outputter 'TimeMeasurements' unless options[:dry_run]
|
21
|
+
@io = ensure_io(path_or_io)
|
22
|
+
@options = options
|
23
|
+
@json_content = []
|
30
24
|
end
|
31
25
|
|
32
26
|
#@api private
|
33
|
-
def before_feature(
|
34
|
-
@
|
35
|
-
@
|
36
|
-
@
|
37
|
-
@
|
38
|
-
@
|
27
|
+
def before_feature(feature)
|
28
|
+
@in_test_cases = false
|
29
|
+
@current_feature = feature
|
30
|
+
@current_feature_timestamp = Time.now.strftime("%FT%T%z")
|
31
|
+
@outline_tags = []
|
32
|
+
@current_feature_info = {
|
33
|
+
feature: @current_feature,
|
34
|
+
tags: [],
|
35
|
+
timestamp: @current_feature_timestamp,
|
36
|
+
scenarios: []
|
37
|
+
}
|
38
|
+
|
39
|
+
@outline_scenario_info = {
|
40
|
+
name: [],
|
41
|
+
tags: [],
|
42
|
+
timestamp: [],
|
43
|
+
test_run: []
|
44
|
+
}
|
39
45
|
end
|
40
46
|
|
41
47
|
#@api private
|
@@ -45,76 +51,121 @@ module QAT
|
|
45
51
|
|
46
52
|
#@api private
|
47
53
|
def tag_name(tag_name)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
54
|
+
@test_id = tag_name.to_s
|
55
|
+
@current_feature_info[:tags] << tag_name unless @in_test_cases
|
56
|
+
|
57
|
+
if @in_test_cases
|
58
|
+
if @current_scenario.is_a?(::Cucumber::Core::Ast::ScenarioOutline)
|
59
|
+
@outline_tags << tag_name
|
60
|
+
else
|
61
|
+
@current_scenario_info[:tags] << tag_name
|
62
|
+
end
|
63
|
+
end
|
55
64
|
end
|
56
65
|
|
57
66
|
#@api private
|
58
67
|
def before_test_case(test_case)
|
59
|
-
@current_feature = test_case.source[0]
|
60
68
|
@current_scenario = test_case.source[1]
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
69
|
+
@current_scenario_timestamp = Time.now.strftime("%FT%T%z")
|
70
|
+
|
71
|
+
unless @current_scenario.is_a?(::Cucumber::Core::Ast::ScenarioOutline)
|
72
|
+
@current_scenario_info = {
|
73
|
+
name: @current_scenario,
|
74
|
+
tags: [],
|
75
|
+
timestamp: @current_scenario_timestamp,
|
76
|
+
test_run: []
|
77
|
+
}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
#@api private
|
82
|
+
def before_outline_table(*_)
|
83
|
+
@outline = true
|
84
|
+
@outline_scenario_info = {
|
85
|
+
name: @current_scenario,
|
86
|
+
tags: [],
|
87
|
+
timestamp: @current_scenario_timestamp,
|
88
|
+
test_run: []
|
89
|
+
}
|
65
90
|
end
|
66
91
|
|
67
92
|
#@api private
|
68
93
|
def after_test_case(_, status)
|
69
|
-
|
70
|
-
"passed"
|
71
|
-
elsif status.is_a? ::Cucumber::Core::Test::Result::Failed
|
72
|
-
"failed"
|
73
|
-
else
|
74
|
-
"not_runned"
|
75
|
-
end
|
76
|
-
|
77
|
-
duration = ::Cucumber::Formatter::DurationExtractor.new(status).result_duration
|
94
|
+
duration = ::Cucumber::Formatter::DurationExtractor.new(status).result_duration
|
78
95
|
human_duration = format_duration(duration)
|
79
96
|
|
80
|
-
|
97
|
+
|
81
98
|
test_run_id = QAT[:current_test_run_id]
|
82
99
|
begin
|
83
100
|
measurements = QAT::Reporter::Times.generate_time_report QAT[:current_test_id]
|
84
101
|
rescue
|
85
|
-
measurements =
|
102
|
+
measurements = []
|
86
103
|
end
|
87
104
|
|
88
|
-
unless measurements
|
105
|
+
unless measurements == [] || measurements == {}
|
89
106
|
measurements.each do |id, measure|
|
90
|
-
@measurement_id
|
107
|
+
@measurement_id = id
|
91
108
|
@measurement_name = measure[:name]
|
92
109
|
end
|
93
110
|
|
94
111
|
unless @measurement_id.nil?
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
scenario: @current_scenario,
|
99
|
-
status: test_status,
|
100
|
-
test_id: test_id,
|
101
|
-
test_run_id: test_run_id,
|
112
|
+
test_run_info = {
|
113
|
+
id: test_run_id,
|
114
|
+
timestamp: Time.now.strftime("%FT%T%z"),
|
102
115
|
measurements: [
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
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
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
109
136
|
|
110
|
-
|
137
|
+
#@api private
|
138
|
+
def after_examples_array(*_)
|
139
|
+
@outline_scenario_info[:tags] = @outline_tags
|
140
|
+
@current_feature_info[:scenarios] << @outline_scenario_info
|
141
|
+
@outline = true
|
142
|
+
@outline_tags = []
|
143
|
+
end
|
111
144
|
|
112
|
-
|
113
|
-
|
145
|
+
#@api private
|
146
|
+
def after_feature_element(*_)
|
147
|
+
#After outline run, here cucumber changes for non outline, flag needed for outlines scenarios
|
148
|
+
if @outline == true
|
149
|
+
@outline = false
|
150
|
+
else
|
151
|
+
@current_feature_info[:scenarios] << @current_scenario_info
|
114
152
|
end
|
153
|
+
@in_test_cases = true
|
154
|
+
end
|
115
155
|
|
116
|
-
|
117
|
-
|
156
|
+
#@api private
|
157
|
+
def after_feature(*_)
|
158
|
+
@indexes = []
|
159
|
+
@scenarios = @current_feature_info[:scenarios]
|
160
|
+
@scenarios.each_with_index do |key, value|
|
161
|
+
if key[:test_run].empty?
|
162
|
+
@indexes << value
|
163
|
+
end
|
164
|
+
end
|
165
|
+
@indexes.reverse!.each do |v|
|
166
|
+
@current_feature_info[:scenarios].delete_at(v)
|
167
|
+
end
|
168
|
+
@json_content << @current_feature_info unless @scenarios.empty?
|
118
169
|
end
|
119
170
|
|
120
171
|
#@api private
|
@@ -122,13 +173,11 @@ module QAT
|
|
122
173
|
publish_result
|
123
174
|
end
|
124
175
|
|
125
|
-
|
126
176
|
private
|
127
177
|
|
128
178
|
# Writes results to a JSON file
|
129
179
|
def publish_result
|
130
|
-
|
131
|
-
@io.puts(JSON.pretty_generate(content))
|
180
|
+
@io.puts(JSON.pretty_generate(@json_content))
|
132
181
|
end
|
133
182
|
end
|
134
183
|
end
|
data/lib/qat/reporter/version.rb
CHANGED
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.
|
4
|
+
version: 6.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- QAT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: qat-cucumber
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
|
-
rubygems_version: 3.0.
|
113
|
+
rubygems_version: 3.0.6
|
114
114
|
signing_key:
|
115
115
|
specification_version: 4
|
116
116
|
summary: Utility for Test Reports.
|