allure-rspec 0.2 → 0.3
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 -0
- data/Gemfile.lock +7 -4
- data/README.md +4 -0
- data/allure-model.xsd +171 -0
- data/allure-rspec.gemspec +1 -0
- data/lib/allure-rspec/builder.rb +32 -19
- data/lib/allure-rspec/dsl.rb +14 -4
- data/lib/allure-rspec/formatter.rb +14 -2
- data/lib/allure-rspec/version.rb +1 -1
- data/logo.png +0 -0
- data/spec/extend_steps_spec.rb +3 -3
- metadata +19 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 76c5c9a1660e8ae8746b73e8fa6111c6261aa607
|
|
4
|
+
data.tar.gz: 8b5820b53d091ce34e3474d44ce65f3afb790fa3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6c27669cf4e08e0c9095075931741c8a2cead92b037467837e2dd864b34dcd3864c9ed057fbc5005dfd1b0fa8e84ea9cd962259d2677884440fc6dde66337ee
|
|
7
|
+
data.tar.gz: 56d2544deeef8891b7bb37e5d105369eafece2959178ce8b9407b6ccec1892723aea9602166caae5f3bf58f81ee0328d731751d3fb8e5065cfec9f951ae1ec8f
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
allure-rspec (0.
|
|
4
|
+
allure-rspec (0.3)
|
|
5
|
+
mimemagic
|
|
5
6
|
nokogiri (~> 1.6.0)
|
|
6
7
|
rspec (~> 2.13.0)
|
|
7
8
|
uuid
|
|
@@ -10,8 +11,9 @@ GEM
|
|
|
10
11
|
remote: https://rubygems.org/
|
|
11
12
|
specs:
|
|
12
13
|
diff-lcs (1.2.5)
|
|
13
|
-
macaddr (1.
|
|
14
|
-
systemu (~> 2.
|
|
14
|
+
macaddr (1.7.1)
|
|
15
|
+
systemu (~> 2.6.2)
|
|
16
|
+
mimemagic (0.2.1)
|
|
15
17
|
mini_portile (0.5.2)
|
|
16
18
|
nokogiri (1.6.0)
|
|
17
19
|
mini_portile (~> 0.5.0)
|
|
@@ -24,7 +26,7 @@ GEM
|
|
|
24
26
|
rspec-expectations (2.13.0)
|
|
25
27
|
diff-lcs (>= 1.1.3, < 2.0)
|
|
26
28
|
rspec-mocks (2.13.1)
|
|
27
|
-
systemu (2.
|
|
29
|
+
systemu (2.6.4)
|
|
28
30
|
uuid (2.3.7)
|
|
29
31
|
macaddr (~> 1.0)
|
|
30
32
|
|
|
@@ -34,6 +36,7 @@ PLATFORMS
|
|
|
34
36
|
DEPENDENCIES
|
|
35
37
|
allure-rspec!
|
|
36
38
|
bundler
|
|
39
|
+
mimemagic
|
|
37
40
|
nokogiri (~> 1.6.0)
|
|
38
41
|
rake
|
|
39
42
|
rspec (~> 2.13.0)
|
data/README.md
CHANGED
data/allure-model.xsd
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
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/allure-rspec.gemspec
CHANGED
data/lib/allure-rspec/builder.rb
CHANGED
|
@@ -81,6 +81,7 @@ module AllureRSpec
|
|
|
81
81
|
:title => attachment[:title],
|
|
82
82
|
:source => attachment[:source],
|
|
83
83
|
:type => attachment[:type],
|
|
84
|
+
:size => attachment[:size],
|
|
84
85
|
}
|
|
85
86
|
if step.nil?
|
|
86
87
|
self.suites[suite][:tests][test][:attachments] << attach
|
|
@@ -112,28 +113,40 @@ module AllureRSpec
|
|
|
112
113
|
def each_suite_build(&block)
|
|
113
114
|
suites_xml = []
|
|
114
115
|
self.suites.each do |suite_title, suite|
|
|
115
|
-
builder = Nokogiri::XML::Builder.new do
|
|
116
|
-
send "test-suite", :start => suite[:start] || 0, :stop => suite[:stop] || 0 do
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
failure
|
|
123
|
-
|
|
124
|
-
|
|
116
|
+
builder = Nokogiri::XML::Builder.new do |xml|
|
|
117
|
+
xml.send "ns2:test-suite", :start => suite[:start] || 0, :stop => suite[:stop] || 0, 'xmlns' => '', "xmlns:ns2" => "urn:model.allure.qatools.yandex.ru" do
|
|
118
|
+
xml.send "name", suite_title
|
|
119
|
+
xml.send "test-cases" do
|
|
120
|
+
suite[:tests].each do |test_title, test|
|
|
121
|
+
xml.send "test-case", :start => test[:start] || 0, :stop => test[:stop] || 0, :status => test[:status] do
|
|
122
|
+
xml.send "name", test_title
|
|
123
|
+
unless test[:failure].nil?
|
|
124
|
+
xml.failure do
|
|
125
|
+
xml.message test[:failure][:message]
|
|
126
|
+
xml.send "stack-trace", test[:failure][:stacktrace]
|
|
127
|
+
end
|
|
125
128
|
end
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
xml.steps do
|
|
130
|
+
test[:steps].each do |step_title, step_obj|
|
|
131
|
+
xml.step(:start => step_obj[:start] || 0, :stop => step_obj[:stop] || 0, :status => step_obj[:status]) do
|
|
132
|
+
xml.send "name", step_title
|
|
133
|
+
xml.attachments do
|
|
134
|
+
step_obj[:attachments].each do |attach|
|
|
135
|
+
xml.attachment :source => attach[:source], :title => attach[:title], :size => attach[:size], :type => attach[:type]
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
132
139
|
end
|
|
133
140
|
end
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
141
|
+
xml.attachments do
|
|
142
|
+
test[:attachments].each do |attach|
|
|
143
|
+
xml.attachment :source => attach[:source], :title => attach[:title], :size => attach[:size], :type => attach[:type]
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
xml.labels do
|
|
147
|
+
xml.label :name => "severity", :value => test[:severity]
|
|
148
|
+
end
|
|
149
|
+
xml.parameters
|
|
137
150
|
end
|
|
138
151
|
end
|
|
139
152
|
end
|
data/lib/allure-rspec/dsl.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'digest'
|
|
2
|
+
require 'mimemagic'
|
|
1
3
|
module AllureRSpec
|
|
2
4
|
module DSL
|
|
3
5
|
|
|
@@ -33,12 +35,20 @@ module AllureRSpec
|
|
|
33
35
|
|
|
34
36
|
def attach_file(title, file)
|
|
35
37
|
step = __current_step
|
|
38
|
+
dir = Pathname.new(AllureRSpec::Config.output_dir)
|
|
39
|
+
FileUtils.mkdir_p(dir)
|
|
40
|
+
file_extname = File.extname(file.path.downcase)
|
|
41
|
+
type = MimeMagic.by_path(file.path) || "text/plain"
|
|
42
|
+
attachment = dir.join("#{Digest::SHA256.file(file.path).hexdigest}-attachment#{(file_extname.empty?) ? '' : file_extname}")
|
|
43
|
+
FileUtils.cp(file.path, attachment)
|
|
36
44
|
suite = self.example.metadata[:example_group][:description_args].first
|
|
37
45
|
test = self.example.metadata[:description]
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
AllureRSpec::Builder.add_attachment(suite, test, {
|
|
47
|
+
:type => type,
|
|
48
|
+
:title => title,
|
|
49
|
+
:source => attachment.basename,
|
|
50
|
+
:size => File.stat(attachment).size
|
|
51
|
+
}, step)
|
|
42
52
|
end
|
|
43
53
|
end
|
|
44
54
|
end
|
|
@@ -45,14 +45,26 @@ module AllureRSpec
|
|
|
45
45
|
super
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
def start(example_count)
|
|
49
|
+
dir = Pathname.new(AllureRSpec::Config.output_dir)
|
|
50
|
+
FileUtils.rm_rf(dir)
|
|
51
|
+
end
|
|
52
|
+
|
|
48
53
|
def stop
|
|
49
54
|
AllureRSpec::Builder.each_suite_build do |suite, xml|
|
|
50
55
|
dir = Pathname.new(AllureRSpec::Config.output_dir)
|
|
51
|
-
FileUtils.rm_rf(dir)
|
|
52
56
|
FileUtils.mkdir_p(dir)
|
|
53
|
-
|
|
57
|
+
out_file = dir.join("#{UUID.new.generate}.xml")
|
|
58
|
+
File.open(out_file, 'w+') do |file|
|
|
54
59
|
file.write(xml)
|
|
55
60
|
end
|
|
61
|
+
|
|
62
|
+
#xsd = Nokogiri::XML::Schema(File.read("allure-model.xsd"))
|
|
63
|
+
#doc = Nokogiri::XML(File.read(out_file))
|
|
64
|
+
#
|
|
65
|
+
#xsd.validate(doc).each do |error|
|
|
66
|
+
# puts error.message
|
|
67
|
+
#end
|
|
56
68
|
end
|
|
57
69
|
super
|
|
58
70
|
end
|
data/lib/allure-rspec/version.rb
CHANGED
data/logo.png
ADDED
|
Binary file
|
data/spec/extend_steps_spec.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.3'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ilya Sadykov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2014-07-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - '>='
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
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'
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: bundler
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -91,6 +105,7 @@ files:
|
|
|
91
105
|
- Gemfile
|
|
92
106
|
- Gemfile.lock
|
|
93
107
|
- README.md
|
|
108
|
+
- allure-model.xsd
|
|
94
109
|
- allure-rspec.gemspec
|
|
95
110
|
- lib/allure-rspec.rb
|
|
96
111
|
- lib/allure-rspec/adaptor.rb
|
|
@@ -98,6 +113,7 @@ files:
|
|
|
98
113
|
- lib/allure-rspec/dsl.rb
|
|
99
114
|
- lib/allure-rspec/formatter.rb
|
|
100
115
|
- lib/allure-rspec/version.rb
|
|
116
|
+
- logo.png
|
|
101
117
|
- spec/extend_steps_spec.rb
|
|
102
118
|
- spec/spec_helper.rb
|
|
103
119
|
homepage: http://allure.qatools.ru
|
|
@@ -123,5 +139,5 @@ rubyforge_project:
|
|
|
123
139
|
rubygems_version: 2.0.3
|
|
124
140
|
signing_key:
|
|
125
141
|
specification_version: 4
|
|
126
|
-
summary: allure-rspec-0.
|
|
142
|
+
summary: allure-rspec-0.3
|
|
127
143
|
test_files: []
|