qat-reporter 6.0.2 → 6.1.0
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/qat/formatter/json.rb +16 -0
- data/lib/qat/formatter/time_measurements.rb +135 -0
- data/lib/qat/reporter/times/report.rb +2 -2
- data/lib/qat/reporter/version.rb +1 -1
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe672befb4141493780885ad000c091f3305bd7218f602f5230313c5250135e8
|
4
|
+
data.tar.gz: 576f6a3ac4e7fd93670f01b63f4d6e31371e4d33e1c0535c273e8ff087122d7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ad43167d0d7b721041d3fac69a42f554a73d718f6e6ce39af2bdabbfa1d6e0661356c057cc290562eb921a4a3a2aea75b31fbbfc96c2e327adb0aea479cf84d
|
7
|
+
data.tar.gz: e132a8cf3460143a2cd8e0345b738a16fefcc807933d641f17783087ca36a5b0aebe988bb599f7d68d58b202f82d05d341b28d17abe3f14dac0aa641ac9a1fa0
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'cucumber/formatter/json'
|
2
|
+
|
3
|
+
module QAT
|
4
|
+
# Namespace for custom Cucumber formatters and helpers.
|
5
|
+
#@since 0.1.0
|
6
|
+
module Formatter
|
7
|
+
# Namespace for Json formatter
|
8
|
+
#@since 6.1.0
|
9
|
+
class Json < ::Cucumber::Formatter::Json
|
10
|
+
|
11
|
+
#@api private
|
12
|
+
def embed *_
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
require 'cucumber/formatter/console'
|
2
|
+
require 'cucumber/formatter/io'
|
3
|
+
require 'cucumber/formatter/duration'
|
4
|
+
require 'cucumber/formatter/duration_extractor'
|
5
|
+
require 'json'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'qat/logger'
|
8
|
+
require 'qat/formatter/loggable'
|
9
|
+
require_relative '../../qat/reporter/times'
|
10
|
+
|
11
|
+
module QAT
|
12
|
+
# Namespace for custom Cucumber formatters and helpers.
|
13
|
+
#@since 0.1.0
|
14
|
+
module Formatter
|
15
|
+
# Namespace for Time Measurements formatter
|
16
|
+
#@since 1.0.0
|
17
|
+
class TimeMeasurements
|
18
|
+
include ::Cucumber::Formatter::Io
|
19
|
+
include ::Cucumber::Formatter::Duration
|
20
|
+
include QAT::Formatter::Loggable
|
21
|
+
include QAT::Logger
|
22
|
+
|
23
|
+
#@api private
|
24
|
+
def initialize(runtime, path_or_io, options)
|
25
|
+
@io = ensure_io(path_or_io)
|
26
|
+
@options = options
|
27
|
+
@test_results = []
|
28
|
+
|
29
|
+
# ensure_outputter 'TimeMeasurements' unless options[:dry_run]
|
30
|
+
end
|
31
|
+
|
32
|
+
#@api private
|
33
|
+
def before_feature(*_)
|
34
|
+
@feature_requirement_ids = []
|
35
|
+
@test_requirement_ids = []
|
36
|
+
@in_test_cases = false
|
37
|
+
@row_counter = 0
|
38
|
+
@flag_tag = nil
|
39
|
+
end
|
40
|
+
|
41
|
+
#@api private
|
42
|
+
def feature_name(*_)
|
43
|
+
@in_test_cases = true
|
44
|
+
end
|
45
|
+
|
46
|
+
#@api private
|
47
|
+
def tag_name(tag_name)
|
48
|
+
# @test_id = tag_name.to_s
|
49
|
+
# requirement_id = tag_name.to_s.split('#')[1] if tag_name.match(/@user_story#(\d+)/)
|
50
|
+
# if @in_test_cases
|
51
|
+
# @test_requirement_ids << requirement_id
|
52
|
+
# else
|
53
|
+
# @feature_requirement_ids << requirement_id
|
54
|
+
# end
|
55
|
+
end
|
56
|
+
|
57
|
+
#@api private
|
58
|
+
def before_test_case(test_case)
|
59
|
+
@current_feature = test_case.source[0]
|
60
|
+
@current_scenario = test_case.source[1]
|
61
|
+
# unless @current_scenario.is_a?(::Cucumber::Core::Ast::ScenarioOutline)
|
62
|
+
# @test_id = nil
|
63
|
+
# @test_requirement_ids = []
|
64
|
+
# end
|
65
|
+
end
|
66
|
+
|
67
|
+
#@api private
|
68
|
+
def after_test_case(_, status)
|
69
|
+
test_status = if status.is_a? ::Cucumber::Core::Test::Result::Passed
|
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
|
78
|
+
human_duration = format_duration(duration)
|
79
|
+
|
80
|
+
test_id = QAT[:current_test_id]
|
81
|
+
test_run_id = QAT[:current_test_run_id]
|
82
|
+
begin
|
83
|
+
measurements = QAT::Reporter::Times.generate_time_report QAT[:current_test_id]
|
84
|
+
rescue
|
85
|
+
measurements = nil
|
86
|
+
end
|
87
|
+
|
88
|
+
unless measurements.nil?
|
89
|
+
measurements.each do |id, measure|
|
90
|
+
@measurement_id = id
|
91
|
+
@measurement_name = measure[:name]
|
92
|
+
end
|
93
|
+
|
94
|
+
unless @measurement_id.nil?
|
95
|
+
@test_results <<
|
96
|
+
{
|
97
|
+
feature: @current_feature,
|
98
|
+
scenario: @current_scenario,
|
99
|
+
status: test_status,
|
100
|
+
test_id: test_id,
|
101
|
+
test_run_id: test_run_id,
|
102
|
+
measurements: [
|
103
|
+
id: @measurement_id,
|
104
|
+
name: @measurement_name,
|
105
|
+
time: {
|
106
|
+
duration: duration,
|
107
|
+
human_duration: human_duration
|
108
|
+
}
|
109
|
+
|
110
|
+
]
|
111
|
+
|
112
|
+
}
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
@test_requirement_ids = [] unless @current_scenario.is_a?(::Cucumber::Core::Ast::ScenarioOutline)
|
117
|
+
@flag_tag = @test_id if @flag_tag != @test_id
|
118
|
+
end
|
119
|
+
|
120
|
+
#@api private
|
121
|
+
def after_features(*_)
|
122
|
+
publish_result
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
private
|
127
|
+
|
128
|
+
# Writes results to a JSON file
|
129
|
+
def publish_result
|
130
|
+
content = @test_results
|
131
|
+
@io.puts(JSON.pretty_generate(content))
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -18,8 +18,8 @@ module QAT
|
|
18
18
|
table_data = data.map do |_, measure|
|
19
19
|
{
|
20
20
|
'Interaction' => measure[:name],
|
21
|
-
'Start' => measure[:start].strftime('%Y-%m-%d %
|
22
|
-
'End' => measure[:end].strftime('%Y-%m-%d %
|
21
|
+
'Start' => measure[:start].strftime('%Y-%m-%d %H:%M:%S %z'),
|
22
|
+
'End' => measure[:end].strftime('%Y-%m-%d %H:%M:%S %z'),
|
23
23
|
'Duration' => human_formatted_time(measure[:duration]),
|
24
24
|
}
|
25
25
|
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.0
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- QAT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07
|
11
|
+
date: 2019-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: qat-cucumber
|
@@ -59,6 +59,9 @@ dependencies:
|
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '6.0'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 6.0.1
|
62
65
|
type: :development
|
63
66
|
prerelease: false
|
64
67
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -66,6 +69,9 @@ dependencies:
|
|
66
69
|
- - "~>"
|
67
70
|
- !ruby/object:Gem::Version
|
68
71
|
version: '6.0'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 6.0.1
|
69
75
|
description: |2
|
70
76
|
QAT Reporter is a collection of tool for generating test report information such as:
|
71
77
|
- Requirement Coverage
|
@@ -75,7 +81,9 @@ extensions: []
|
|
75
81
|
extra_rdoc_files: []
|
76
82
|
files:
|
77
83
|
- LICENSE
|
84
|
+
- lib/qat/formatter/json.rb
|
78
85
|
- lib/qat/formatter/req_coverage.rb
|
86
|
+
- lib/qat/formatter/time_measurements.rb
|
79
87
|
- lib/qat/reporter/formatters/ascii_table.rb
|
80
88
|
- lib/qat/reporter/hooks/time_reporter.rb
|
81
89
|
- lib/qat/reporter/times.rb
|