teamcity_formatter 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c6bdd2ee8cc84d330e2b27bba38179598a764965
4
- data.tar.gz: fc2da8f296b354e4d4be2036cb63808ca796514f
3
+ metadata.gz: b1e00edb6a138b70ca7bc206f8c6d1ad15661bda
4
+ data.tar.gz: 412bc7a87bdc89b82d7f4a485d0e7f253401a16e
5
5
  SHA512:
6
- metadata.gz: b2a1e15dd7c4a1ff3bdf15245ec15f62a76bd53727ffe3516ad6617b2e3527bec4c4fbd49e2e0329b19e2804d24df4171bfa8fcedec668d3f65e8db797f5d1fb
7
- data.tar.gz: 2d74eff353b22ec7801467d63ee2160921531052baf9ddeee4a172175039bfb9affebd68bf7657c8f971cbf5144c6f3fca2b7810e99c43c13fa7898ea3af99c5
6
+ metadata.gz: 216e531e2e73a4fa757a23e1e06b2f0733fed19265e26ebc342a1808e5cc604daa5d7dde38fdafddcdddd85abf5ce38a66d2e2583e24cff9e0fbe880c6effe6d
7
+ data.tar.gz: afb159525bd623b3219994a58c87fa07326eea2d08545740a42b63ed862432a3e847d6bc2dd94b8c50c50e8d5dd5bdb417e089a263367a508be55d8b877092fd
@@ -76,7 +76,11 @@ module TeamCityFormatter
76
76
  example = @scenario_outline.examples.find { |example| example.column_values == cuke_table_row.cells }
77
77
  test_name = scenario_outline_test_name(@scenario_outline.name, example.column_values)
78
78
  if exception
79
- @logger.test_failed(test_name, exception)
79
+ if exception.is_a? ::Cucumber::Pending
80
+ @logger.test_ignored(test_name, 'Pending test')
81
+ else
82
+ @logger.test_failed(test_name, exception)
83
+ end
80
84
  end
81
85
  @logger.test_finished(test_name)
82
86
 
@@ -117,7 +121,11 @@ module TeamCityFormatter
117
121
  def after_scenario(cuke_scenario)
118
122
  test_name = @scenario.name
119
123
  if @exception
120
- @logger.test_failed_with_exception(test_name, @exception)
124
+ if @exception.is_a? ::Cucumber::Pending
125
+ @logger.test_ignored(test_name, 'Pending test')
126
+ else
127
+ @logger.test_failed_with_exception(test_name, @exception)
128
+ end
121
129
  end
122
130
  # a background step previously failed and was reported the first time the failure happened
123
131
  if (cuke_scenario.status == :skipped) && (@exception == nil)
@@ -131,7 +139,7 @@ module TeamCityFormatter
131
139
  end
132
140
 
133
141
  def scenario_outline_test_name(scenario_outline_name, example_column_values)
134
- "#{scenario_outline_name} - | #{example_column_values.join(' | ')} |"
142
+ "#{scenario_outline_name} | #{example_column_values.join(' | ')} |"
135
143
  end
136
144
  end
137
145
  end
@@ -5,15 +5,15 @@ module TeamCityFormatter
5
5
  end
6
6
 
7
7
  def test_suite_started(test_suite_name)
8
- render_output("##teamcity[testSuiteStarted name='#{teamcity_escape(test_suite_name)}' timestamp='#{timestamp}']")
8
+ render_output("##teamcity[testSuiteStarted flowId='#{flow_id}' name='#{teamcity_escape(test_suite_name)}' timestamp='#{timestamp}']")
9
9
  end
10
10
 
11
11
  def test_suite_finished(test_suite_name)
12
- render_output("##teamcity[testSuiteFinished name='#{teamcity_escape(test_suite_name)}' timestamp='#{timestamp}']")
12
+ render_output("##teamcity[testSuiteFinished flowId='#{flow_id}' name='#{teamcity_escape(test_suite_name)}' timestamp='#{timestamp}']")
13
13
  end
14
14
 
15
15
  def test_started(test_name)
16
- render_output("##teamcity[testStarted name='#{teamcity_escape(test_name)}' timestamp='#{timestamp}' captureStandardOutput='true']")
16
+ render_output("##teamcity[testStarted flowId='#{flow_id}' name='#{teamcity_escape(test_name)}' captureStandardOutput='true' timestamp='#{timestamp}']")
17
17
  end
18
18
 
19
19
  def test_failed_with_exception(test_name, exception)
@@ -22,11 +22,15 @@ module TeamCityFormatter
22
22
  end
23
23
 
24
24
  def test_failed(test_name, details)
25
- render_output("##teamcity[testFailed name='#{teamcity_escape(test_name)}' timestamp='#{timestamp}' details='#{teamcity_escape(details)}']")
25
+ render_output("##teamcity[testFailed flowId='#{flow_id}' name='#{teamcity_escape(test_name)}' message='#{teamcity_escape(details)}' timestamp='#{timestamp}']")
26
+ end
27
+
28
+ def test_ignored(test_name, details)
29
+ render_output("##teamcity[testIgnored flowId='#{flow_id}' name='#{teamcity_escape(test_name)}' message='#{teamcity_escape(details)}' timestamp='#{timestamp}']")
26
30
  end
27
31
 
28
32
  def test_finished(test_name)
29
- render_output("##teamcity[testFinished name='#{teamcity_escape(test_name)}' timestamp='#{timestamp}']")
33
+ render_output("##teamcity[testFinished flowId='#{flow_id}' name='#{teamcity_escape(test_name)}' timestamp='#{timestamp}']")
30
34
  end
31
35
 
32
36
  private
@@ -38,11 +42,13 @@ module TeamCityFormatter
38
42
 
39
43
  def teamcity_escape(s)
40
44
  s.to_s.strip
41
- .gsub('|', '||')
42
- .gsub("'", "|'")
43
- .gsub(']', '|]')
44
- .gsub("\r", '|r')
45
- .gsub("\n", '|n')
45
+ .gsub(':', ' -')
46
+ .gsub('|', '||')
47
+ .gsub("'", "|'")
48
+ .gsub(']', '|]')
49
+ .gsub('[', '|[')
50
+ .gsub("\r", '|r')
51
+ .gsub("\n", '|n')
46
52
  end
47
53
 
48
54
  def timestamp_short
@@ -59,5 +65,9 @@ module TeamCityFormatter
59
65
  lines = ["#{exception.message} (#{exception.class})"] + exception.backtrace
60
66
  lines.join("\n")
61
67
  end
68
+
69
+ def flow_id
70
+ Process.pid
71
+ end
62
72
  end
63
73
  end
data/readme.md CHANGED
@@ -39,12 +39,30 @@ Sceanrio Outline Example | Test
39
39
 
40
40
  Test failures include the stack trace of the exception which triggered the failure.
41
41
 
42
+ ## Features
43
+
44
+ ### Support [parallel_cucumber](https://rubygems.org/gems/parallel_cucumber)
45
+
46
+ The formatter now includes a `flowId` attribute in output messages. `flowId` is the test runner process id.
47
+
48
+ ### Pending Scenarios and Scenario Examples
49
+
50
+ Pending scenarios and scenario examples are logged as ignored tests.
51
+
42
52
  ## Acknowledgements
43
53
 
44
54
  This gem drew some code from [`cucumber_teamcity`](https://github.com/ankurcha/cucumber_teamcity/). The `cucumber_teamcity` formatter is not compatible with Cucumber 2.
45
55
 
46
56
  Also, though we did not use code from their project, JetBrains makes available some TeamCity-related code [here](https://github.com/JetBrains/intellij-plugins/tree/master/ruby-testing/src/rb/testing/patch/bdd/teamcity), which may be of interest to others researching TeamCity Cucumber formatters.
47
57
 
58
+ Thank you to contributors:
59
+
60
+ Contributor | Contribution
61
+ --- | ---
62
+ [PositiveAlex](https://github.com/PositiveAlex) | Allow cucumber to use the formatter directly from the command line
63
+ [aklossrbh](https://github.com/aklossrbh) | Support [parallel_cucumber](https://rubygems.org/gems/parallel_cucumber)
64
+ [gricsi](https://github.com/gricsi) | Log pending scenarios and scenario examples as ignored tests
65
+
48
66
  ## License
49
67
 
50
68
  Apache License, Version 2.0
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teamcity_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Rood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-01 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ">="
16
+ - - '>='
17
17
  - !ruby/object:Gem::Version
18
18
  version: '2.0'
19
19
  name: cucumber
@@ -21,7 +21,7 @@ dependencies:
21
21
  type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
27
  description: Render cucumber test output in a format consumable by TeamCity
@@ -46,17 +46,17 @@ require_paths:
46
46
  - lib
47
47
  required_ruby_version: !ruby/object:Gem::Requirement
48
48
  requirements:
49
- - - ">="
49
+ - - '>='
50
50
  - !ruby/object:Gem::Version
51
51
  version: '0'
52
52
  required_rubygems_version: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - ">="
54
+ - - '>='
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  requirements: []
58
58
  rubyforge_project:
59
- rubygems_version: 2.4.8
59
+ rubygems_version: 2.1.9
60
60
  signing_key:
61
61
  specification_version: 4
62
62
  summary: TeamCity cucumber output formatter