allure-ruby-adaptor-api 0.6.3 → 0.6.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 +4 -4
- data/Gemfile.lock +1 -1
- data/LICENSE +13 -0
- data/README.md +14 -13
- data/lib/allure-ruby-adaptor-api/builder.rb +12 -10
- data/lib/allure-ruby-adaptor-api/version.rb +1 -1
- data/spec/extend_steps_spec.rb +3 -0
- metadata +4 -4
- data/lib/allure-ruby-adaptor-api/dsl.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27837ff6b9eb83bdb943e375d766a683b288d7d8
|
4
|
+
data.tar.gz: 08555e5992f1ef918e9d287efde0db0d676f98ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e63ed1e8a6790b471f4439bbc5f15922c32bf492f64cab993697f61922d0dd1128b517335ca5e2646e18901c14c74bfa54b0582239acfe62fe768ee3ee2177a2
|
7
|
+
data.tar.gz: 1b2c28606153bdc0b776d6688ade612ce7f44ed5be107726997d1f4e6f4b39131bec85277289d409a9fa08dfcd8261b99b92f1c7a6ded9f7cf6702640ca61a10
|
data/Gemfile.lock
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2014 YANDEX
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -26,19 +26,20 @@ your current directory.
|
|
26
26
|
## Usage examples
|
27
27
|
|
28
28
|
```ruby
|
29
|
-
AllureRubyAdaptorApi::Builder
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
29
|
+
builder = AllureRubyAdaptorApi::Builder
|
30
|
+
builder.start_suite "some_suite", :severity => :normal
|
31
|
+
builder.start_test "some_suite", "some_test", :feature => "Some feature", :severity => :critical
|
32
|
+
builder.start_step "some_suite", "some_test", "first step"
|
33
|
+
builder.add_attachment "some_suite", "some_test", :file => Tempfile.new("somefile")
|
34
|
+
builder.stop_step "some_suite", "some_test", "first step"
|
35
|
+
builder.start_step "some_suite", "some_test", "second step"
|
36
|
+
builder.add_attachment "some_suite", "some_test", :step => "second step", :file => Tempfile.new("somefile")
|
37
|
+
builder.stop_step "some_suite", "some_test", "second step"
|
38
|
+
builder.start_step "some_suite", "some_test", "third step"
|
39
|
+
builder.stop_step "some_suite", "some_test", "third step", :failed
|
40
|
+
builder.stop_test "some_suite", "some_test", :status => :broken, :exception => Exception.new("some error")
|
41
|
+
builder.stop_suite "some_suite"
|
41
42
|
|
42
43
|
# This will generate the results within your output directory
|
43
|
-
|
44
|
+
builder.build!
|
44
45
|
```
|
@@ -46,7 +46,7 @@ module AllureRubyAdaptorApi
|
|
46
46
|
MUTEX.synchronize do
|
47
47
|
puts "Stopping test #{suite}.#{test}"
|
48
48
|
self.suites[suite][:tests][test][:stop] = timestamp(result[:finished_at])
|
49
|
-
self.suites[suite][:tests][test][:start] = timestamp(result[:started_at])
|
49
|
+
self.suites[suite][:tests][test][:start] = timestamp(result[:started_at]) if result[:started_at]
|
50
50
|
self.suites[suite][:tests][test][:status] = result[:status]
|
51
51
|
if (result[:status].to_sym != :passed)
|
52
52
|
self.suites[suite][:tests][test][:failure] = {
|
@@ -149,16 +149,18 @@ module AllureRubyAdaptorApi
|
|
149
149
|
xml_labels(xml, suite[:labels])
|
150
150
|
end
|
151
151
|
end
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
152
|
+
unless suite[:tests].empty?
|
153
|
+
xml = builder.to_xml
|
154
|
+
xml = yield suite, xml if block_given?
|
155
|
+
dir = Pathname.new(config.output_dir)
|
156
|
+
FileUtils.mkdir_p(dir)
|
157
|
+
out_file = dir.join("#{UUID.new.generate}-testsuite.xml")
|
158
|
+
puts "Writing file '#{out_file}'..."
|
159
|
+
File.open(out_file, 'w+') do |file|
|
160
|
+
file.write(validate_xml(xml))
|
161
|
+
end
|
162
|
+
suites_xml << xml
|
160
163
|
end
|
161
|
-
suites_xml << xml
|
162
164
|
end
|
163
165
|
suites_xml
|
164
166
|
end
|
data/spec/extend_steps_spec.rb
CHANGED
@@ -17,6 +17,9 @@ describe AllureRubyAdaptorApi do
|
|
17
17
|
builder.stop_test "some_suite", "some_test", :status => :broken, :exception => Exception.new("some error")
|
18
18
|
builder.stop_suite "some_suite"
|
19
19
|
|
20
|
+
builder.start_suite "some_empty_suite"
|
21
|
+
builder.stop_suite "some_empty_suite"
|
22
|
+
|
20
23
|
builder.build! {|suite, xml|
|
21
24
|
xml.should_not be_empty
|
22
25
|
xml.should include("<ns2:test-suite")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allure-ruby-adaptor-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Sadykov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -91,12 +91,12 @@ files:
|
|
91
91
|
- .gitignore
|
92
92
|
- Gemfile
|
93
93
|
- Gemfile.lock
|
94
|
+
- LICENSE
|
94
95
|
- README.md
|
95
96
|
- allure-model-1.4.0.xsd
|
96
97
|
- allure-ruby-adaptor-api.gemspec
|
97
98
|
- lib/allure-ruby-adaptor-api.rb
|
98
99
|
- lib/allure-ruby-adaptor-api/builder.rb
|
99
|
-
- lib/allure-ruby-adaptor-api/dsl.rb
|
100
100
|
- lib/allure-ruby-adaptor-api/version.rb
|
101
101
|
- spec/extend_steps_spec.rb
|
102
102
|
- spec/spec_helper.rb
|
@@ -123,6 +123,6 @@ rubyforge_project:
|
|
123
123
|
rubygems_version: 2.0.3
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
|
-
summary: allure-ruby-adaptor-api-0.6.
|
126
|
+
summary: allure-ruby-adaptor-api-0.6.4
|
127
127
|
test_files: []
|
128
128
|
has_rdoc:
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'digest'
|
2
|
-
require 'mimemagic'
|
3
|
-
module AllureRubyAdaptorApi
|
4
|
-
module DSL
|
5
|
-
|
6
|
-
|
7
|
-
def step(step, &block)
|
8
|
-
suite = self.example.metadata[:example_group][:description_args].first
|
9
|
-
test = self.example.metadata[:description]
|
10
|
-
AllureRSpec::Builder.start_step(suite, test, step)
|
11
|
-
__with_step step, &block
|
12
|
-
AllureRSpec::Builder.stop_step(suite, test, step)
|
13
|
-
end
|
14
|
-
|
15
|
-
def attach_file(title, file, mime_type = nil)
|
16
|
-
step = current_step
|
17
|
-
dir = Pathname.new(AllureRSpec::Config.output_dir)
|
18
|
-
FileUtils.mkdir_p(dir)
|
19
|
-
file_extname = File.extname(file.path.downcase)
|
20
|
-
mime_type ||= MimeMagic.by_path(file.path) || "text/plain"
|
21
|
-
attachment = dir.join("#{Digest::SHA256.file(file.path).hexdigest}-attachment#{(file_extname.empty?) ? '' : file_extname}")
|
22
|
-
FileUtils.cp(file.path, attachment)
|
23
|
-
suite = self.example.metadata[:example_group][:description_args].first
|
24
|
-
test = self.example.metadata[:description]
|
25
|
-
AllureRubyAdaptorApi::Builder.add_attachment(suite, test, {
|
26
|
-
:type => type,
|
27
|
-
:title => title,
|
28
|
-
:source => attachment.basename,
|
29
|
-
:size => File.stat(attachment).size,
|
30
|
-
:mime_type => mime_type
|
31
|
-
}, step)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|