allure-rspec 0.4.2 → 0.5.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/Gemfile +1 -2
- data/Gemfile.lock +10 -9
- data/README.md +10 -3
- data/allure-rspec.gemspec +0 -3
- data/lib/allure-rspec.rb +9 -1
- data/lib/allure-rspec/dsl.rb +21 -30
- data/lib/allure-rspec/formatter.rb +12 -23
- data/lib/allure-rspec/version.rb +1 -1
- metadata +3 -47
- data/allure-model.xsd +0 -171
- data/lib/allure-rspec/builder.rb +0 -182
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4626a6eeb97f523375d513c76fc22cd796864d88
|
4
|
+
data.tar.gz: 4cadd49b7f4d032d25d1e7769a2a061e91431598
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 861abf562a8def12955cf5e3d11db427741dbe899f6a8542202568ee8d2f7d056abf270c2c392033448493a4ff2b5161250a4e1726fab0459628667553403eaf
|
7
|
+
data.tar.gz: 8c2d6ae757c83ff486958a8dd73e89b49e29eee9730f0382c2edb42796e739c4f02197b458dd28878b2af8cd635dff0fa416fba83240da9c9300a55d53602581
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,22 +1,24 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
allure-rspec (0.
|
5
|
-
mimemagic
|
6
|
-
nokogiri (~> 1.6.0)
|
4
|
+
allure-rspec (0.5.0)
|
7
5
|
rspec (~> 2.14.0)
|
8
|
-
uuid
|
9
6
|
|
10
7
|
GEM
|
11
8
|
remote: https://rubygems.org/
|
12
9
|
specs:
|
10
|
+
allure-ruby-api (0.6)
|
11
|
+
mimemagic
|
12
|
+
nokogiri (~> 1.6.0)
|
13
|
+
rspec (~> 2.14.0)
|
14
|
+
uuid
|
13
15
|
diff-lcs (1.2.5)
|
14
16
|
macaddr (1.7.1)
|
15
17
|
systemu (~> 2.6.2)
|
16
18
|
mimemagic (0.2.1)
|
17
|
-
mini_portile (0.
|
18
|
-
nokogiri (1.6.
|
19
|
-
mini_portile (
|
19
|
+
mini_portile (0.6.0)
|
20
|
+
nokogiri (1.6.3.1)
|
21
|
+
mini_portile (= 0.6.0)
|
20
22
|
rake (10.1.0)
|
21
23
|
rspec (2.14.1)
|
22
24
|
rspec-core (~> 2.14.0)
|
@@ -35,8 +37,7 @@ PLATFORMS
|
|
35
37
|
|
36
38
|
DEPENDENCIES
|
37
39
|
allure-rspec!
|
40
|
+
allure-ruby-api (= 0.6)
|
38
41
|
bundler
|
39
|
-
mimemagic
|
40
|
-
nokogiri (~> 1.6.0)
|
41
42
|
rake
|
42
43
|
rspec (~> 2.14.0)
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Adaptor to use the Allure framework along with the RSpec
|
|
4
4
|
|
5
5
|
## What's new
|
6
6
|
|
7
|
+
* *0.5.0* - Migrating to allure-ruby-api.
|
8
|
+
* *0.4.2* - Support for labels (feature,story,severity,language,framework).
|
7
9
|
* *0.4.1* - Support for before/after(:step) hooks.
|
8
10
|
* *0.3.1* - Allure 1.4.0 format support.
|
9
11
|
|
@@ -30,20 +32,25 @@ your current directory.
|
|
30
32
|
|
31
33
|
```ruby
|
32
34
|
AllureRSpec.configure do |c|
|
33
|
-
c.output_dir = "/whatever/you/like"
|
35
|
+
c.output_dir = "/whatever/you/like" # default: allure/data
|
36
|
+
c.clean_dir = false # clean the output directory first? (default: true)
|
34
37
|
end
|
35
38
|
```
|
36
39
|
|
37
40
|
## Usage examples
|
38
41
|
|
39
42
|
```ruby
|
40
|
-
describe MySpec do
|
43
|
+
describe MySpec, :feature => "Some feature", :severity => :normal do
|
41
44
|
|
42
45
|
before(:step) do |s|
|
43
46
|
puts "Before step #{s.current_step}"
|
44
47
|
end
|
45
48
|
|
46
|
-
it "should be
|
49
|
+
it "should be critical", :story => "First story", :severity => :critical do
|
50
|
+
"string".should == "string"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should be steps enabled", :story => ["First story", "Second story"] do
|
47
54
|
|
48
55
|
step "step1" do
|
49
56
|
attach_file "screenshot1", take_screenshot_as_file
|
data/allure-rspec.gemspec
CHANGED
@@ -19,9 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.require_paths = ['lib']
|
20
20
|
|
21
21
|
s.add_dependency 'rspec', '~> 2.14.0'
|
22
|
-
s.add_dependency 'nokogiri', '~> 1.6.0'
|
23
|
-
s.add_dependency 'uuid'
|
24
|
-
s.add_dependency 'mimemagic'
|
25
22
|
|
26
23
|
s.add_development_dependency 'bundler'
|
27
24
|
s.add_development_dependency 'rake'
|
data/lib/allure-rspec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
+
require 'allure-ruby-api'
|
1
2
|
require 'allure-rspec/version'
|
2
3
|
require 'allure-rspec/formatter'
|
3
4
|
require 'allure-rspec/adaptor'
|
4
5
|
require 'allure-rspec/dsl'
|
5
|
-
require 'allure-rspec/builder'
|
6
6
|
require 'allure-rspec/hooks'
|
7
7
|
|
8
8
|
module AllureRSpec
|
@@ -11,12 +11,17 @@ module AllureRSpec
|
|
11
11
|
module Config
|
12
12
|
class << self
|
13
13
|
attr_accessor :output_dir
|
14
|
+
attr_accessor :clean_dir
|
14
15
|
|
15
16
|
DEFAULT_OUTPUT_DIR = 'allure/data'
|
16
17
|
|
17
18
|
def output_dir
|
18
19
|
@output_dir || DEFAULT_OUTPUT_DIR
|
19
20
|
end
|
21
|
+
|
22
|
+
def clean_dir?
|
23
|
+
@clean_dir || true
|
24
|
+
end
|
20
25
|
end
|
21
26
|
end
|
22
27
|
|
@@ -37,6 +42,9 @@ module AllureRSpec
|
|
37
42
|
class << self
|
38
43
|
def configure(&block)
|
39
44
|
yield Config
|
45
|
+
AllureRubyApi.configure {|c|
|
46
|
+
c.output_dir = Config.output_dir
|
47
|
+
}
|
40
48
|
end
|
41
49
|
end
|
42
50
|
|
data/lib/allure-rspec/dsl.rb
CHANGED
@@ -2,10 +2,6 @@ require 'digest'
|
|
2
2
|
require 'mimemagic'
|
3
3
|
module AllureRSpec
|
4
4
|
module DSL
|
5
|
-
def __mutex
|
6
|
-
@@__mutex ||= Mutex.new
|
7
|
-
end
|
8
|
-
|
9
5
|
def current_step
|
10
6
|
if defined? @@__current_step
|
11
7
|
@@__current_step
|
@@ -14,6 +10,27 @@ module AllureRSpec
|
|
14
10
|
end
|
15
11
|
end
|
16
12
|
|
13
|
+
def step(step, &block)
|
14
|
+
suite = self.example.metadata[:example_group][:description_args].first
|
15
|
+
test = self.example.metadata[:description]
|
16
|
+
AllureRubyApi::Builder.start_step(suite, test, step)
|
17
|
+
__with_step step, &block
|
18
|
+
AllureRubyApi::Builder.stop_step(suite, test, step)
|
19
|
+
end
|
20
|
+
|
21
|
+
def attach_file(title, file, opts = {})
|
22
|
+
suite = self.example.metadata[:example_group][:description_args].first
|
23
|
+
test = self.example.metadata[:description]
|
24
|
+
step = current_step
|
25
|
+
AllureRubyApi::Builder.add_attachment suite, test, opts.merge(:file => file, :title => title, :step => step)
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def __mutex
|
31
|
+
@@__mutex ||= Mutex.new
|
32
|
+
end
|
33
|
+
|
17
34
|
def __with_step(step, &block)
|
18
35
|
__mutex.synchronize do
|
19
36
|
begin
|
@@ -26,32 +43,6 @@ module AllureRSpec
|
|
26
43
|
end
|
27
44
|
end
|
28
45
|
end
|
29
|
-
|
30
|
-
def step(step, &block)
|
31
|
-
suite = self.example.metadata[:example_group][:description_args].first
|
32
|
-
test = self.example.metadata[:description]
|
33
|
-
AllureRSpec::Builder.start_step(suite, test, step)
|
34
|
-
__with_step step, &block
|
35
|
-
AllureRSpec::Builder.stop_step(suite, test, step)
|
36
|
-
end
|
37
|
-
|
38
|
-
def attach_file(title, file)
|
39
|
-
step = current_step
|
40
|
-
dir = Pathname.new(AllureRSpec::Config.output_dir)
|
41
|
-
FileUtils.mkdir_p(dir)
|
42
|
-
file_extname = File.extname(file.path.downcase)
|
43
|
-
type = MimeMagic.by_path(file.path) || "text/plain"
|
44
|
-
attachment = dir.join("#{Digest::SHA256.file(file.path).hexdigest}-attachment#{(file_extname.empty?) ? '' : file_extname}")
|
45
|
-
FileUtils.cp(file.path, attachment)
|
46
|
-
suite = self.example.metadata[:example_group][:description_args].first
|
47
|
-
test = self.example.metadata[:description]
|
48
|
-
AllureRSpec::Builder.add_attachment(suite, test, {
|
49
|
-
:type => type,
|
50
|
-
:title => title,
|
51
|
-
:source => attachment.basename,
|
52
|
-
:size => File.stat(attachment).size
|
53
|
-
}, step)
|
54
|
-
end
|
55
46
|
end
|
56
47
|
end
|
57
48
|
|
@@ -1,6 +1,5 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
require 'uuid'
|
3
1
|
require 'rspec/core/formatters/base_formatter'
|
2
|
+
require 'fileutils'
|
4
3
|
|
5
4
|
module AllureRSpec
|
6
5
|
|
@@ -9,7 +8,7 @@ module AllureRSpec
|
|
9
8
|
ALLOWED_LABELS = [:feature, :story, :severity, :language, :framework]
|
10
9
|
|
11
10
|
def example_failed(example)
|
12
|
-
|
11
|
+
AllureRubyApi::Builder.stop_test(
|
13
12
|
example.metadata[:example_group][:description_args].first,
|
14
13
|
example.metadata[:description],
|
15
14
|
example.metadata[:execution_result].merge(
|
@@ -21,17 +20,17 @@ module AllureRSpec
|
|
21
20
|
end
|
22
21
|
|
23
22
|
def example_group_finished(group)
|
24
|
-
|
23
|
+
AllureRubyApi::Builder.stop_suite(group.metadata[:example_group][:description_args].first)
|
25
24
|
super
|
26
25
|
end
|
27
26
|
|
28
27
|
def example_group_started(group)
|
29
|
-
|
28
|
+
AllureRubyApi::Builder.start_suite(group.metadata[:example_group][:description_args].first, labels(group))
|
30
29
|
super
|
31
30
|
end
|
32
31
|
|
33
32
|
def example_passed(example)
|
34
|
-
|
33
|
+
AllureRubyApi::Builder.stop_test(
|
35
34
|
example.metadata[:example_group][:description_args].first,
|
36
35
|
example.metadata[:description],
|
37
36
|
example.metadata[:execution_result].merge(:caller => example.metadata[:caller])
|
@@ -46,31 +45,21 @@ module AllureRSpec
|
|
46
45
|
def example_started(example)
|
47
46
|
suite = example.metadata[:example_group][:description_args].first
|
48
47
|
test = example.metadata[:description]
|
49
|
-
|
48
|
+
AllureRubyApi::Builder.start_test(suite, test, labels(example))
|
50
49
|
super
|
51
50
|
end
|
52
51
|
|
53
52
|
def start(example_count)
|
54
53
|
dir = Pathname.new(AllureRSpec::Config.output_dir)
|
55
|
-
|
54
|
+
if AllureRSpec::Config.clean_dir?
|
55
|
+
FileUtils.rm_rf(dir)
|
56
|
+
end
|
57
|
+
FileUtils.mkdir_p(dir)
|
58
|
+
super
|
56
59
|
end
|
57
60
|
|
58
61
|
def stop
|
59
|
-
|
60
|
-
dir = Pathname.new(AllureRSpec::Config.output_dir)
|
61
|
-
FileUtils.mkdir_p(dir)
|
62
|
-
out_file = dir.join("#{UUID.new.generate}-testsuite.xml")
|
63
|
-
File.open(out_file, 'w+') do |file|
|
64
|
-
file.write(xml)
|
65
|
-
end
|
66
|
-
|
67
|
-
xsd = Nokogiri::XML::Schema(File.read(Pathname.new(File.dirname(__FILE__)).join("../../allure-model.xsd")))
|
68
|
-
doc = Nokogiri::XML(File.read(out_file))
|
69
|
-
|
70
|
-
xsd.validate(doc).each do |error|
|
71
|
-
$stderr.puts error.message
|
72
|
-
end
|
73
|
-
end
|
62
|
+
AllureRubyApi::Builder.build!
|
74
63
|
super
|
75
64
|
end
|
76
65
|
|
data/lib/allure-rspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allure-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
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-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -24,48 +24,6 @@ dependencies:
|
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.14.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: nokogiri
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.6.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 1.6.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: uuid
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: mimemagic
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
27
|
- !ruby/object:Gem::Dependency
|
70
28
|
name: bundler
|
71
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -105,11 +63,9 @@ files:
|
|
105
63
|
- Gemfile
|
106
64
|
- Gemfile.lock
|
107
65
|
- README.md
|
108
|
-
- allure-model.xsd
|
109
66
|
- allure-rspec.gemspec
|
110
67
|
- lib/allure-rspec.rb
|
111
68
|
- lib/allure-rspec/adaptor.rb
|
112
|
-
- lib/allure-rspec/builder.rb
|
113
69
|
- lib/allure-rspec/dsl.rb
|
114
70
|
- lib/allure-rspec/formatter.rb
|
115
71
|
- lib/allure-rspec/hooks.rb
|
@@ -141,5 +97,5 @@ rubyforge_project:
|
|
141
97
|
rubygems_version: 2.0.3
|
142
98
|
signing_key:
|
143
99
|
specification_version: 4
|
144
|
-
summary: allure-rspec-0.
|
100
|
+
summary: allure-rspec-0.5.0
|
145
101
|
test_files: []
|
data/allure-model.xsd
DELETED
@@ -1,171 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified"
|
3
|
-
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
4
|
-
xmlns:qa="urn:model.allure.qatools.yandex.ru"
|
5
|
-
targetNamespace="urn:model.allure.qatools.yandex.ru">
|
6
|
-
|
7
|
-
<xs:element name="test-suite" type="qa:test-suite-result"/>
|
8
|
-
|
9
|
-
<xs:complexType name="test-suite-result">
|
10
|
-
<xs:all>
|
11
|
-
<xs:element name="name" type="xs:string"/>
|
12
|
-
<xs:element name="title" type="xs:string" minOccurs="0"/>
|
13
|
-
<xs:element name="description" type="qa:description" minOccurs="0"/>
|
14
|
-
<xs:element name="test-cases" type="qa:test-cases-result" minOccurs="0"/>
|
15
|
-
<xs:element name="labels" type="qa:labels" minOccurs="0"/>
|
16
|
-
</xs:all>
|
17
|
-
<xs:attribute name="start" type="xs:long" use="required"/>
|
18
|
-
<xs:attribute name="stop" type="xs:long" use="required"/>
|
19
|
-
<xs:attribute name="version" type="xs:string"/>
|
20
|
-
</xs:complexType>
|
21
|
-
|
22
|
-
<xs:complexType name="test-cases-result">
|
23
|
-
<xs:sequence>
|
24
|
-
<xs:element name="test-case" type="qa:test-case-result" maxOccurs="unbounded" minOccurs="0"/>
|
25
|
-
</xs:sequence>
|
26
|
-
</xs:complexType>
|
27
|
-
|
28
|
-
<xs:complexType name="test-case-result">
|
29
|
-
<xs:all>
|
30
|
-
<xs:element name="name" type="xs:string"/>
|
31
|
-
<xs:element name="title" type="xs:string" minOccurs="0"/>
|
32
|
-
<xs:element name="description" type="qa:description" minOccurs="0"/>
|
33
|
-
<xs:element name="failure" type="qa:failure" minOccurs="0"/>
|
34
|
-
<xs:element name="steps" type="qa:steps" minOccurs="0"/>
|
35
|
-
<xs:element name="attachments" type="qa:attachments" minOccurs="0"/>
|
36
|
-
<xs:element name="labels" type="qa:labels" minOccurs="0"/>
|
37
|
-
<xs:element name="parameters" type="qa:parameters" minOccurs="0"/>
|
38
|
-
</xs:all>
|
39
|
-
<xs:attribute name="start" type="xs:long" use="required"/>
|
40
|
-
<xs:attribute name="stop" type="xs:long" use="required"/>
|
41
|
-
<xs:attribute name="status" type="qa:status" use="required"/>
|
42
|
-
</xs:complexType>
|
43
|
-
|
44
|
-
<xs:complexType name="steps">
|
45
|
-
<xs:sequence>
|
46
|
-
<xs:element name="step" type="qa:step" minOccurs="0" maxOccurs="unbounded"/>
|
47
|
-
</xs:sequence>
|
48
|
-
</xs:complexType>
|
49
|
-
|
50
|
-
<xs:complexType name="step">
|
51
|
-
<xs:all>
|
52
|
-
<xs:element name="name" type="xs:string"/>
|
53
|
-
<xs:element name="title" type="xs:string" minOccurs="0"/>
|
54
|
-
<xs:element name="attachments" type="qa:attachments" minOccurs="0"/>
|
55
|
-
<xs:element name="steps" type="qa:steps" minOccurs="0"/>
|
56
|
-
</xs:all>
|
57
|
-
<xs:attribute name="start" type="xs:long" use="required"/>
|
58
|
-
<xs:attribute name="stop" type="xs:long" use="required"/>
|
59
|
-
<xs:attribute name="status" type="qa:status" use="required"/>
|
60
|
-
</xs:complexType>
|
61
|
-
|
62
|
-
<xs:complexType name="failure">
|
63
|
-
<xs:all>
|
64
|
-
<xs:element name="message" type="xs:string"/>
|
65
|
-
<xs:element name="stack-trace" type="xs:string" minOccurs="0"/>
|
66
|
-
</xs:all>
|
67
|
-
</xs:complexType>
|
68
|
-
|
69
|
-
<xs:complexType name="labels">
|
70
|
-
<xs:sequence>
|
71
|
-
<xs:element name="label" type="qa:label" minOccurs="0" maxOccurs="unbounded"/>
|
72
|
-
</xs:sequence>
|
73
|
-
</xs:complexType>
|
74
|
-
|
75
|
-
<xs:complexType name="label">
|
76
|
-
<xs:attribute name="name" type="xs:string" use="required"/>
|
77
|
-
<xs:attribute name="value" type="xs:string" use="required"/>
|
78
|
-
</xs:complexType>
|
79
|
-
|
80
|
-
<xs:complexType name="parameters">
|
81
|
-
<xs:sequence>
|
82
|
-
<xs:element name="parameter" type="qa:parameter" minOccurs="0" maxOccurs="unbounded"/>
|
83
|
-
</xs:sequence>
|
84
|
-
</xs:complexType>
|
85
|
-
|
86
|
-
<xs:complexType name="parameter">
|
87
|
-
<xs:attribute name="name" type="xs:string" use="required"/>
|
88
|
-
<xs:attribute name="value" type="xs:string" use="required"/>
|
89
|
-
<xs:attribute name="kind" type="qa:parameter-kind" use="required"/>
|
90
|
-
</xs:complexType>
|
91
|
-
|
92
|
-
<xs:simpleType name="parameter-kind">
|
93
|
-
<xs:restriction base="xs:string">
|
94
|
-
<xs:enumeration value="argument"/>
|
95
|
-
<xs:enumeration value="system-property"/>
|
96
|
-
<xs:enumeration value="environment-variable"/>
|
97
|
-
</xs:restriction>
|
98
|
-
</xs:simpleType>
|
99
|
-
|
100
|
-
<xs:complexType name="attachments">
|
101
|
-
<xs:sequence>
|
102
|
-
<xs:element name="attachment" type="qa:attachment" minOccurs="0" maxOccurs="unbounded"/>
|
103
|
-
</xs:sequence>
|
104
|
-
</xs:complexType>
|
105
|
-
|
106
|
-
<xs:complexType name="attachment">
|
107
|
-
<xs:attribute name="title" type="xs:string" use="required"/>
|
108
|
-
<xs:attribute name="source" type="xs:string" use="required"/>
|
109
|
-
<xs:attribute name="type" type="xs:string" use="required"/>
|
110
|
-
<xs:attribute name="size" type="xs:int"/>
|
111
|
-
</xs:complexType>
|
112
|
-
|
113
|
-
<!--Deprecated, will be removed in 1.4.0-->
|
114
|
-
<xs:simpleType name="attachment-type">
|
115
|
-
<xs:restriction base="xs:string">
|
116
|
-
<xs:enumeration value="txt"/>
|
117
|
-
<xs:enumeration value="html"/>
|
118
|
-
<xs:enumeration value="xml"/>
|
119
|
-
<xs:enumeration value="png"/>
|
120
|
-
<xs:enumeration value="jpg"/>
|
121
|
-
<xs:enumeration value="json"/>
|
122
|
-
<xs:enumeration value="other"/>
|
123
|
-
</xs:restriction>
|
124
|
-
</xs:simpleType>
|
125
|
-
|
126
|
-
<xs:simpleType name="status">
|
127
|
-
<xs:restriction base="xs:string">
|
128
|
-
<xs:enumeration value="failed"/>
|
129
|
-
<xs:enumeration value="broken"/>
|
130
|
-
<xs:enumeration value="passed"/>
|
131
|
-
<xs:enumeration value="canceled"/>
|
132
|
-
<xs:enumeration value="pending"/>
|
133
|
-
</xs:restriction>
|
134
|
-
</xs:simpleType>
|
135
|
-
|
136
|
-
<xs:simpleType name="label-name">
|
137
|
-
<xs:restriction base="xs:string">
|
138
|
-
<xs:enumeration value="feature"/>
|
139
|
-
<xs:enumeration value="story"/>
|
140
|
-
<xs:enumeration value="severity"/>
|
141
|
-
<xs:enumeration value="language"/>
|
142
|
-
<xs:enumeration value="framework"/>
|
143
|
-
</xs:restriction>
|
144
|
-
</xs:simpleType>
|
145
|
-
|
146
|
-
<xs:simpleType name="severity-level">
|
147
|
-
<xs:restriction base="xs:string">
|
148
|
-
<xs:enumeration value="blocker"/>
|
149
|
-
<xs:enumeration value="critical"/>
|
150
|
-
<xs:enumeration value="normal"/>
|
151
|
-
<xs:enumeration value="minor"/>
|
152
|
-
<xs:enumeration value="trivial"/>
|
153
|
-
</xs:restriction>
|
154
|
-
</xs:simpleType>
|
155
|
-
|
156
|
-
<xs:complexType name="description">
|
157
|
-
<xs:simpleContent>
|
158
|
-
<xs:extension base="xs:string">
|
159
|
-
<xs:attribute name="type" type="qa:description-type" default="text"/>
|
160
|
-
</xs:extension>
|
161
|
-
</xs:simpleContent>
|
162
|
-
</xs:complexType>
|
163
|
-
|
164
|
-
<xs:simpleType name="description-type">
|
165
|
-
<xs:restriction base="xs:string">
|
166
|
-
<xs:enumeration value="markdown"/>
|
167
|
-
<xs:enumeration value="text"/>
|
168
|
-
<xs:enumeration value="html"/>
|
169
|
-
</xs:restriction>
|
170
|
-
</xs:simpleType>
|
171
|
-
</xs:schema>
|
data/lib/allure-rspec/builder.rb
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
require 'rexml/text'
|
2
|
-
|
3
|
-
module AllureRSpec
|
4
|
-
|
5
|
-
class Builder
|
6
|
-
class << self
|
7
|
-
attr_accessor :suites
|
8
|
-
MUTEX = Mutex.new
|
9
|
-
|
10
|
-
def init_suites
|
11
|
-
MUTEX.synchronize {
|
12
|
-
self.suites ||= {}
|
13
|
-
}
|
14
|
-
end
|
15
|
-
|
16
|
-
def start_suite(title, labels = [:severity => :normal])
|
17
|
-
init_suites
|
18
|
-
MUTEX.synchronize do
|
19
|
-
puts "Starting case_or_suite #{title} with labels #{labels}"
|
20
|
-
self.suites[title] = {
|
21
|
-
:title => title,
|
22
|
-
:start => timestamp,
|
23
|
-
:tests => {},
|
24
|
-
:labels => labels
|
25
|
-
}
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def start_test(suite, test, labels = [:severity => :normal])
|
30
|
-
MUTEX.synchronize do
|
31
|
-
puts "Starting test #{suite}.#{test} with labels #{labels}"
|
32
|
-
self.suites[suite][:tests][test] = {
|
33
|
-
:title => test,
|
34
|
-
:start => timestamp,
|
35
|
-
:failure => nil,
|
36
|
-
:steps => {},
|
37
|
-
:attachments => [],
|
38
|
-
:labels => labels,
|
39
|
-
}
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def stop_test(suite, test, result = {})
|
44
|
-
self.suites[suite][:tests][test][:steps].each do |step_title, step|
|
45
|
-
if step[:stop].nil? || step[:stop] == 0
|
46
|
-
stop_step(suite, test, step_title, result[:status])
|
47
|
-
end
|
48
|
-
end
|
49
|
-
MUTEX.synchronize do
|
50
|
-
puts "Stopping test #{suite}.#{test}"
|
51
|
-
self.suites[suite][:tests][test][:stop] = timestamp(result[:finished_at])
|
52
|
-
self.suites[suite][:tests][test][:start] = timestamp(result[:started_at])
|
53
|
-
self.suites[suite][:tests][test][:status] = result[:status]
|
54
|
-
if (result[:status].to_sym != :passed)
|
55
|
-
self.suites[suite][:tests][test][:failure] = {
|
56
|
-
:stacktrace => escape(((result[:exception] && result[:exception].backtrace) || []).map { |s| s.to_s }.join("\r\n")),
|
57
|
-
:message => escape(result[:exception].to_s),
|
58
|
-
}
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def escape(text)
|
65
|
-
#REXML::Text.new(text, false, nil, false)
|
66
|
-
text
|
67
|
-
end
|
68
|
-
|
69
|
-
def start_step(suite, test, step)
|
70
|
-
MUTEX.synchronize do
|
71
|
-
puts "Starting step #{suite}.#{test}.#{step}"
|
72
|
-
self.suites[suite][:tests][test][:steps][step] = {
|
73
|
-
:title => step,
|
74
|
-
:start => timestamp,
|
75
|
-
:attachments => []
|
76
|
-
}
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def add_attachment(suite, test, attachment, step = nil)
|
81
|
-
attach = {
|
82
|
-
:title => attachment[:title],
|
83
|
-
:source => attachment[:source],
|
84
|
-
:type => attachment[:type],
|
85
|
-
:size => attachment[:size],
|
86
|
-
}
|
87
|
-
if step.nil?
|
88
|
-
self.suites[suite][:tests][test][:attachments] << attach
|
89
|
-
else
|
90
|
-
self.suites[suite][:tests][test][:steps][step][:attachments] << attach
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
def stop_step(suite, test, step, status = :passed)
|
95
|
-
MUTEX.synchronize do
|
96
|
-
puts "Stopping step #{suite}.#{test}.#{step}"
|
97
|
-
self.suites[suite][:tests][test][:steps][step][:stop] = timestamp
|
98
|
-
self.suites[suite][:tests][test][:steps][step][:status] = status
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def stop_suite(title)
|
103
|
-
init_suites
|
104
|
-
MUTEX.synchronize do
|
105
|
-
puts "Stopping case_or_suite #{title}"
|
106
|
-
self.suites[title][:stop] = timestamp
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def timestamp(time = nil)
|
111
|
-
((time || Time.now).to_f * 1000).to_i
|
112
|
-
end
|
113
|
-
|
114
|
-
def each_suite_build(&block)
|
115
|
-
suites_xml = []
|
116
|
-
self.suites.each do |suite_title, suite|
|
117
|
-
builder = Nokogiri::XML::Builder.new do |xml|
|
118
|
-
xml.send "ns2:test-suite", :start => suite[:start] || 0, :stop => suite[:stop] || 0, 'xmlns' => '', "xmlns:ns2" => "urn:model.allure.qatools.yandex.ru" do
|
119
|
-
xml.send :name, suite_title
|
120
|
-
xml.send :title, suite_title
|
121
|
-
xml.send "test-cases" do
|
122
|
-
suite[:tests].each do |test_title, test|
|
123
|
-
xml.send "test-case", :start => test[:start] || 0, :stop => test[:stop] || 0, :status => test[:status] do
|
124
|
-
xml.send :name, test_title
|
125
|
-
xml.send :title, test_title
|
126
|
-
unless test[:failure].nil?
|
127
|
-
xml.failure do
|
128
|
-
xml.message test[:failure][:message]
|
129
|
-
xml.send "stack-trace", test[:failure][:stacktrace]
|
130
|
-
end
|
131
|
-
end
|
132
|
-
xml.steps do
|
133
|
-
test[:steps].each do |step_title, step_obj|
|
134
|
-
xml.step(:start => step_obj[:start] || 0, :stop => step_obj[:stop] || 0, :status => step_obj[:status]) do
|
135
|
-
xml.send :name, step_title
|
136
|
-
xml.send :title, step_title
|
137
|
-
xml_attachments(xml, step_obj[:attachments])
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
xml_attachments(xml, test[:attachments])
|
142
|
-
xml_labels(xml, suite[:labels].merge(test[:labels]))
|
143
|
-
xml.parameters
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
xml_labels(xml, suite[:labels])
|
148
|
-
end
|
149
|
-
end
|
150
|
-
xml = builder.to_xml
|
151
|
-
yield suite, xml
|
152
|
-
suites_xml << xml
|
153
|
-
end
|
154
|
-
suites_xml
|
155
|
-
end
|
156
|
-
|
157
|
-
private
|
158
|
-
|
159
|
-
def xml_attachments(xml, attachments)
|
160
|
-
xml.attachments do
|
161
|
-
attachments.each do |attach|
|
162
|
-
xml.attachment :source => attach[:source], :title => attach[:title], :size => attach[:size], :type => attach[:type]
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
def xml_labels(xml, labels)
|
168
|
-
xml.labels do
|
169
|
-
labels.each do |name, value|
|
170
|
-
if value.is_a?(Array)
|
171
|
-
value.each do |v|
|
172
|
-
xml.label :name => name, :value => v
|
173
|
-
end
|
174
|
-
else
|
175
|
-
xml.label :name => name, :value => value
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|