cucumber_junit_to_json 0.1.3 → 0.1.4
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87eb32c819df8f7e29fa5fdd6935d5a29413a496
|
4
|
+
data.tar.gz: 2610d51b8b5eb6728af43c4e9a77a853b923c066
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8472085871a65fa942e97684af51e6bee4b8f7e98e9ae4997374648b507f73cbee2280021520fc891fed03b44be86d52a796c8fa96d4229e32c76c6d14e3f1a5
|
7
|
+
data.tar.gz: f6dc8fafec1915b13d6062edb4a548a1fac1c09004010b24b22f09e67a964bc26acf2ce68d1710512f850c2988b3fbbf4fb0fc8372792ef6596b5955ac488572
|
@@ -79,6 +79,14 @@ module CucumberJunitToJson
|
|
79
79
|
scenarios = []
|
80
80
|
testcases.each do |testcase|
|
81
81
|
scenario = CucumberJunitToJson::Models::Scenario.new
|
82
|
+
failing_step = nil
|
83
|
+
failure_message = nil
|
84
|
+
if testcase['status'] == 'failed'
|
85
|
+
failure = testcase.css('failure')
|
86
|
+
failure_info = failure.text.split(failure.attribute('message')).first
|
87
|
+
failure_message = failure.attribute('message')
|
88
|
+
failing_step = failure_info.split('Failing step:').last.split('...').first.strip
|
89
|
+
end
|
82
90
|
# Removing scenario outline added blob gives you the actual scenario name
|
83
91
|
scenario.name = testcase['name'].split('-- @').first.strip
|
84
92
|
scenario.tags, scenario.line = @feature_parser.tags_and_line_number_matching(feature_uri, scenario.name)
|
@@ -88,7 +96,7 @@ module CucumberJunitToJson
|
|
88
96
|
scenario.uri = feature_uri
|
89
97
|
scenario.id = @scenario_id
|
90
98
|
scenario_output = get_string_between(testcase.at_css('system-out').text, '@scenario.begin', '@scenario.end')
|
91
|
-
scenario.steps = CucumberJunitToJson::Models::Step.get_steps_for(scenario.name, scenario_output, feature_uri)
|
99
|
+
scenario.steps = CucumberJunitToJson::Models::Step.get_steps_for(scenario.name, scenario_output, feature_uri, failing_step, failure_message)
|
92
100
|
scenarios.push(scenario)
|
93
101
|
@scenario_id += 1
|
94
102
|
end
|
@@ -32,6 +32,9 @@ module CucumberJunitToJson
|
|
32
32
|
json.result do
|
33
33
|
json.status step.result.status
|
34
34
|
json.duration step.result.duration
|
35
|
+
if step.result.error_message
|
36
|
+
json.error_message step.result.error_message
|
37
|
+
end
|
35
38
|
end
|
36
39
|
unless step.table.headings.size.zero?
|
37
40
|
json.table do
|
@@ -6,10 +6,11 @@ module CucumberJunitToJson
|
|
6
6
|
module Models
|
7
7
|
# Abstract representation of a cucumber step result attribute
|
8
8
|
class Result
|
9
|
-
attr_accessor :status, :duration
|
9
|
+
attr_accessor :status, :duration, :error_message
|
10
10
|
def initialize(status, duration)
|
11
11
|
@status = status.to_s.strip
|
12
12
|
@duration = duration.to_f
|
13
|
+
@error_message = nil
|
13
14
|
end
|
14
15
|
end
|
15
16
|
end
|
@@ -15,7 +15,7 @@ module CucumberJunitToJson
|
|
15
15
|
@table = CucumberJunitToJson::Models::Table.new
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.get_steps_for(scenario_title, scenario_str, feature_file_path)
|
18
|
+
def self.get_steps_for(scenario_title, scenario_str, feature_file_path, failing_step = nil, failure_message = nil)
|
19
19
|
steps = []
|
20
20
|
table = []
|
21
21
|
prev_step_has_table = false
|
@@ -39,6 +39,9 @@ module CucumberJunitToJson
|
|
39
39
|
result_duration_str = scenario_step.split('...').last
|
40
40
|
status, duration = result_duration_str.split('in')
|
41
41
|
step.result = CucumberJunitToJson::Models::Result.new(status, duration)
|
42
|
+
if failing_step && failing_step == "#{step.keyword} #{step.name}"
|
43
|
+
step.result.error_message = failure_message
|
44
|
+
end
|
42
45
|
step.line = get_scenario_step_matching(scenario_title, feature_file_path, scenario_step.split('...').first.strip).last
|
43
46
|
steps.push(step)
|
44
47
|
elsif scenario_step.start_with?('|')
|