rspec_testlink_formatters 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0f9c882cdf39838e55b1b609ce920a9a98b4e033
4
+ data.tar.gz: e22d356b64fea838ac91db5e73f1939b89c2a527
5
+ SHA512:
6
+ metadata.gz: 3375f70ba4538479b3076732e253ef8d324419af2b7f02d888ec889d23e5cad60bd3d4ff78739c31e5b0eb97cf94a3422ee7ec86cf93c534f89fd8ca0ef94622
7
+ data.tar.gz: 0f960f234dd888784e6742c5fc0cb2b39cc32549315c94440f155d8bd56b318d8533f7baf92b8bdeda6925bb3979c4a9f84a19d0e09616b4461590d8e373b7bb
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rspec_testlink_formatters.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Pim Snel
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # RspecTestlinkFormatters
2
+
3
+ rspec --format RspecTestlinkJunitformatter -r rspec_testlink_formatters
4
+ rspec --format RspecTestlinkExportCases -r rspec_testlink_formatters
5
+
6
+ TODO: Write a gem description
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'rspec_testlink_formatters'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install rspec_testlink_formatters
23
+
24
+ ## Usage
25
+
26
+ TODO: Write usage instructions here
27
+
28
+ ## Contributing
29
+
30
+ 1. Fork it ( https://github.com/[my-github-username]/rspec_testlink_formatters/fork )
31
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
32
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
33
+ 4. Push to the branch (`git push origin my-new-feature`)
34
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,67 @@
1
+ require "time"
2
+ require "builder"
3
+ require "rspec"
4
+
5
+ require "rspec/core/formatters/base_formatter"
6
+ class RspecTestlinkExportCases < RSpec::Core::Formatters::BaseFormatter
7
+ RSpec::Core::Formatters.register self,
8
+ :start,
9
+ :stop,
10
+ :dump_summary
11
+
12
+ def start(notification)
13
+ @start_notification = notification
14
+ @started = Time.now
15
+ super
16
+ end
17
+
18
+ def stop(notification)
19
+ @examples_notification = notification
20
+ end
21
+
22
+ def dump_summary(notification)
23
+ @summary_notification = notification
24
+ xml_dump
25
+ end
26
+
27
+ private
28
+
29
+ attr_reader :started
30
+
31
+ def example_count
32
+ @summary_notification.examples.count
33
+ end
34
+
35
+ def examples
36
+ @examples_notification.notifications
37
+ end
38
+
39
+ def xml
40
+ @xml ||= Builder::XmlMarkup.new target: output, indent: 2
41
+ end
42
+
43
+ def xml_dump
44
+ xml.instruct!
45
+ xml.testcases do
46
+ examples.each do |example|
47
+ xml.testcase name: example.example.description.split('|')[0].strip do
48
+ xml.summary(example.example.location)
49
+ xml.status(1)
50
+ xml.execution_type(2)
51
+ xml.requirements do
52
+ xml.requirement do
53
+ xml.doc_id(example.example.example_group.description.split('|')[1].strip)
54
+ end
55
+ end
56
+ xml.custom_fields do
57
+ xml.custom_field do
58
+ xml.name('RSPEC CASE ID')
59
+ xml.value(example.example.description.split('|')[1].strip)
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
67
+
@@ -0,0 +1,3 @@
1
+ module RspecTestlinkFormatters
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,3 @@
1
+ require "rspec_testlink_formatters/version"
2
+ require File.expand_path(File.dirname(__FILE__) + "/rspec_testlink_export_cases")
3
+ require File.expand_path(File.dirname(__FILE__) + "/rspec_testlink_junit_formatter")
@@ -0,0 +1,121 @@
1
+ require "time"
2
+
3
+ require "builder"
4
+ require "rspec"
5
+
6
+ require "rspec/core/formatters/base_formatter"
7
+
8
+ # Dumps rspec results as a JUnit XML file.
9
+ # Based on XML schema: http://windyroad.org/dl/Open%20Source/JUnit.xsd
10
+ class RspecTestlinkJunitformatter < RSpec::Core::Formatters::BaseFormatter
11
+
12
+ RSpec::Core::Formatters.register self,
13
+ :start,
14
+ :stop,
15
+ :dump_summary
16
+
17
+ def start(notification)
18
+ @start_notification = notification
19
+ @started = Time.now
20
+ super
21
+ end
22
+
23
+ def stop(notification)
24
+ @examples_notification = notification
25
+ end
26
+
27
+ def dump_summary(notification)
28
+ @summary_notification = notification
29
+ xml_dump
30
+ end
31
+
32
+ private
33
+
34
+ attr_reader :started
35
+
36
+ def example_count
37
+ @summary_notification.examples.count
38
+ end
39
+
40
+ def failure_count
41
+ @summary_notification.failed_examples.count
42
+ end
43
+
44
+ def duration
45
+ @summary_notification.duration
46
+ end
47
+
48
+ def examples
49
+ @examples_notification.notifications
50
+ end
51
+
52
+ def result_of(notification)
53
+ notification.example.execution_result[:status]
54
+ end
55
+
56
+ def classname_for(notification)
57
+ notification.example.file_path.sub(%r{\.[^/]*\Z}, "").gsub("/", ".").gsub(%r{\A\.+|\.+\Z}, "")
58
+ end
59
+
60
+ def duration_for(notification)
61
+ notification.example.execution_result[:run_time]
62
+ end
63
+
64
+ def description_for(notification)
65
+ notification.example.full_description
66
+ end
67
+
68
+ def exception_for(notification)
69
+ notification.example.execution_result[:exception]
70
+ end
71
+
72
+ def formatted_backtrace_for(notification)
73
+ backtrace = notification.formatted_backtrace
74
+ end
75
+
76
+ private
77
+
78
+ def xml
79
+ @xml ||= Builder::XmlMarkup.new target: output, indent: 2
80
+ end
81
+
82
+ def xml_dump
83
+ xml.instruct!
84
+ xml.testsuite name: "rspec", tests: example_count, failures: failure_count, errors: 0, time: "%.6f" % duration, timestamp: started.iso8601 do
85
+ xml.properties
86
+ xml_dump_examples
87
+ end
88
+ end
89
+
90
+ def xml_dump_examples
91
+ examples.each do |example|
92
+ send :"xml_dump_#{result_of(example)}", example
93
+ end
94
+ end
95
+
96
+ def xml_dump_passed(example)
97
+ xml_dump_example(example)
98
+ end
99
+
100
+ def xml_dump_pending(example)
101
+ xml_dump_example(example) do
102
+ xml.skipped
103
+ end
104
+ end
105
+
106
+ def xml_dump_failed(example)
107
+ exception = exception_for(example)
108
+ backtrace = formatted_backtrace_for(example)
109
+
110
+ xml_dump_example(example) do
111
+ xml.failure message: exception.to_s, type: exception.class.name do
112
+ xml.cdata! "#{exception.message}\n#{backtrace.join "\n"}"
113
+ end
114
+ end
115
+ end
116
+
117
+ def xml_dump_example(example, &block)
118
+ xml.testcase classname: classname_for(example), name: example.example.description.split('|')[1].strip, time: "%.6f" % duration_for(example), &block
119
+ end
120
+ end
121
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rspec_testlink_formatters/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rspec_testlink_formatters"
8
+ spec.version = RspecTestlinkFormatters::VERSION
9
+ spec.authors = ["Pim Snel"]
10
+ spec.email = ["pim@lingewoud.nl"]
11
+ spec.summary = %q{Formatters for communicating with TestLink}
12
+ spec.description = %q{Formatter for importing testcases into testlink, and formatter for updating testlink with jenkins testlink plugin}
13
+ spec.homepage = "https://github.com/mipmip/rspec_testlink_formatters.git"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency 'testlink_rspec_utils', '~> 0.0.3'
24
+ spec.add_dependency "rspec-core", "~> 3.1.0"
25
+ end
@@ -0,0 +1,31 @@
1
+ require 'rspec'
2
+
3
+ describe "myapp" do
4
+ describe "proj001" do
5
+
6
+ context "req-0001 | req-0001" do
7
+
8
+ it " ... | tc-0001-01" do
9
+ pending("req-0001 | req-0001")
10
+ end
11
+
12
+ it " ... | tc-0001-02" do
13
+ pending("req-0001 | req-0001")
14
+ end
15
+
16
+ it " ... | tc-0001-03" do
17
+ pending("req-0001 | req-0001")
18
+ end
19
+
20
+ end
21
+
22
+ context "req-0002 | req-0002" do
23
+
24
+ it " ... | tc-0002-01" do
25
+ pending("req-0002 | req-0002")
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec_testlink_formatters
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Pim Snel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: testlink_rspec_utils
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 0.0.3
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-core
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 3.1.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 3.1.0
69
+ description: Formatter for importing testcases into testlink, and formatter for updating
70
+ testlink with jenkins testlink plugin
71
+ email:
72
+ - pim@lingewoud.nl
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - lib/rspec_testlink_export_cases.rb
83
+ - lib/rspec_testlink_formatters.rb
84
+ - lib/rspec_testlink_formatters/version.rb
85
+ - lib/rspec_testlink_junit_formatter.rb
86
+ - rspec_testlink_formatters.gemspec
87
+ - spec/req001folder_spec.rb
88
+ homepage: https://github.com/mipmip/rspec_testlink_formatters.git
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.4.2
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Formatters for communicating with TestLink
112
+ test_files:
113
+ - spec/req001folder_spec.rb