webspicy 0.20.8 → 0.20.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/webspicy/specification.rb +5 -1
- data/lib/webspicy/tester.rb +2 -0
- data/lib/webspicy/tester/reporter.rb +1 -0
- data/lib/webspicy/tester/reporter/exceptions.rb +3 -1
- data/lib/webspicy/tester/reporter/junit_xml_file.rb +151 -0
- data/lib/webspicy/tester/reporter/progress.rb +1 -1
- data/lib/webspicy/tester/reporter/summary.rb +1 -1
- data/lib/webspicy/tester/result.rb +1 -0
- data/lib/webspicy/version.rb +1 -1
- data/lib/webspicy/web/specification.rb +1 -1
- data/tasks/test.rake +5 -1
- metadata +21 -10
- data/bin/sandr +0 -14
- data/bin/search +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bdf5cfac3023b3a121368cd16c4b36df8cc212b6093672c836fbb2c392e5d68
|
4
|
+
data.tar.gz: 3506d6e9ec23a6d21299dcabf2564b1d643a49cf58ba853d6263763838d8efe7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c84f0fde9c02350d61969503fd93fa139dc2b39bd377f800597adfae760bfb60b25a83894bac2642b75029c67963a3293a463eed4c00eb85491920a8bd53af4
|
7
|
+
data.tar.gz: f215620b9e9a0b7346c09b1ef1a1d1e3acac1f28f57df64ea0864156ceb9e9a7a888bddb4b67462255efc1a15f9860af368fbe510f148ea09871526e90da79fa
|
@@ -14,6 +14,10 @@ module Webspicy
|
|
14
14
|
@location = Path(location)
|
15
15
|
end
|
16
16
|
|
17
|
+
def relative_location
|
18
|
+
@location && @location.relative_to(config.folder)
|
19
|
+
end
|
20
|
+
|
17
21
|
def locate(relative_path)
|
18
22
|
file = @location.parent/relative_path
|
19
23
|
raise "File not found: #{file}" unless file.exists?
|
@@ -21,7 +25,7 @@ module Webspicy
|
|
21
25
|
end
|
22
26
|
|
23
27
|
def name
|
24
|
-
@raw[:name]
|
28
|
+
@raw[:name] || relative_location || "Unnamed"
|
25
29
|
end
|
26
30
|
|
27
31
|
def services
|
data/lib/webspicy/tester.rb
CHANGED
@@ -15,7 +15,7 @@ module Webspicy
|
|
15
15
|
@spec_file_errors << spec_file_error_line(spec_file, e)
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def test_case_done
|
19
19
|
@failed_results << result unless result.success?
|
20
20
|
end
|
21
21
|
|
@@ -24,6 +24,8 @@ module Webspicy
|
|
24
24
|
report_failed_results
|
25
25
|
end
|
26
26
|
|
27
|
+
private
|
28
|
+
|
27
29
|
def report_spec_file_errors
|
28
30
|
return if spec_file_errors.empty?
|
29
31
|
io.puts
|
@@ -0,0 +1,151 @@
|
|
1
|
+
module Webspicy
|
2
|
+
class Tester
|
3
|
+
class Reporter
|
4
|
+
class JunitXmlFile < Reporter
|
5
|
+
|
6
|
+
TPL = <<~XML
|
7
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
8
|
+
<testsuites
|
9
|
+
disabled="{{counts.disabled}}"
|
10
|
+
errors="{{counts.errors}}"
|
11
|
+
failures="{{counts.failures}}"
|
12
|
+
tests="{{counts.total}}"
|
13
|
+
time="{{time}}s"
|
14
|
+
>
|
15
|
+
{{#testsuites}}
|
16
|
+
<testsuite
|
17
|
+
name="{{name}}"
|
18
|
+
tests="{{counts.total}}"
|
19
|
+
errors="{{counts.errors}}"
|
20
|
+
failures="{{counts.failures}}"
|
21
|
+
time="{{time}}s"
|
22
|
+
>
|
23
|
+
{{#testcases}}
|
24
|
+
<testcase
|
25
|
+
name="{{name}}"
|
26
|
+
assertions="{{assert}}"
|
27
|
+
classname="{{classname}}"
|
28
|
+
status=""
|
29
|
+
time="{{time}}s"
|
30
|
+
>
|
31
|
+
{{#errors}}
|
32
|
+
<error
|
33
|
+
message="{{message}}"
|
34
|
+
type="{{type}}"
|
35
|
+
></error>
|
36
|
+
{{/errors}}
|
37
|
+
{{#failures}}
|
38
|
+
<failure
|
39
|
+
message="{{message}}"
|
40
|
+
type="{{type}}"
|
41
|
+
></failure>
|
42
|
+
{{/failures}}
|
43
|
+
</testcase>
|
44
|
+
{{/testcases}}
|
45
|
+
</testsuite>
|
46
|
+
{{/testsuites}}
|
47
|
+
</testsuites>
|
48
|
+
XML
|
49
|
+
|
50
|
+
def initialize(path_or_io = STDOUT)
|
51
|
+
@path_or_io = path_or_io
|
52
|
+
path_or_io.parent.mkdir_p if path_or_io.is_a?(Path)
|
53
|
+
end
|
54
|
+
|
55
|
+
attr_reader :template_data, :timer_all, :timer_specification, :timer_testcase
|
56
|
+
|
57
|
+
def before_all
|
58
|
+
@timer_all = Time.now
|
59
|
+
@template_data = OpenStruct.new({
|
60
|
+
counts: Hash.new{|h,k| h[k] = 0 },
|
61
|
+
testsuites: []
|
62
|
+
})
|
63
|
+
end
|
64
|
+
|
65
|
+
def after_all
|
66
|
+
template_data.time = Time.now - timer_all
|
67
|
+
end
|
68
|
+
|
69
|
+
def before_specification
|
70
|
+
@timer_specification = Time.now
|
71
|
+
template_data.testsuites << OpenStruct.new({
|
72
|
+
:name => specification.name,
|
73
|
+
:counts => Hash.new{|h,k| h[k] = 0 },
|
74
|
+
:testcases => []
|
75
|
+
})
|
76
|
+
end
|
77
|
+
|
78
|
+
def specification_done
|
79
|
+
template_data.testsuites[-1].time = Time.now - timer_specification
|
80
|
+
end
|
81
|
+
|
82
|
+
def spec_file_error(e)
|
83
|
+
template_data.testsuites[-1].testcases << OpenStruct.new({
|
84
|
+
:name => "Specification can be loaded",
|
85
|
+
:assert => 1,
|
86
|
+
:classname => "Webspicy.Specification",
|
87
|
+
:failures => [],
|
88
|
+
:errors => [OpenStruct.new({
|
89
|
+
:type => e.class,
|
90
|
+
:message => e.message
|
91
|
+
})]
|
92
|
+
})
|
93
|
+
end
|
94
|
+
|
95
|
+
def before_test_case
|
96
|
+
@timer_testcase = Time.now
|
97
|
+
template_data.testsuites[-1].testcases << OpenStruct.new({
|
98
|
+
:name => test_case.description,
|
99
|
+
:assert => test_case.assert.length,
|
100
|
+
:classname => test_case.class.name.to_s.gsub(/::/, "."),
|
101
|
+
:failures => [],
|
102
|
+
:errors => [],
|
103
|
+
})
|
104
|
+
template_data.counts[:total] += 1
|
105
|
+
template_data.testsuites[-1].counts[:total] += 1
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_case_done
|
109
|
+
template_data.testsuites[-1].testcases[-1].time = Time.now - timer_testcase
|
110
|
+
end
|
111
|
+
|
112
|
+
def check_failure(check, ex)
|
113
|
+
template_data.testsuites[-1].testcases[-1].failures << OpenStruct.new({
|
114
|
+
:type => check.class.name,
|
115
|
+
:message => ex.message
|
116
|
+
})
|
117
|
+
template_data.counts[:failures] += 1
|
118
|
+
template_data.testsuites[-1].counts[:failures] += 1
|
119
|
+
end
|
120
|
+
|
121
|
+
def check_error(check, ex)
|
122
|
+
template_data.testsuites[-1].testcases[-1].errors << OpenStruct.new({
|
123
|
+
:type => check.class.name,
|
124
|
+
:message => ex.message
|
125
|
+
})
|
126
|
+
template_data.counts[:errors] += 1
|
127
|
+
template_data.testsuites[-1].counts[:errors] += 1
|
128
|
+
end
|
129
|
+
|
130
|
+
def report
|
131
|
+
require 'mustache'
|
132
|
+
with_io do |io|
|
133
|
+
io << Mustache.render(TPL, template_data)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
private
|
138
|
+
|
139
|
+
def with_io(&bl)
|
140
|
+
case io = @path_or_io
|
141
|
+
when IO, StringIO
|
142
|
+
bl.call(io)
|
143
|
+
else
|
144
|
+
Path(io).open('w', &bl)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
end # class JunitXmlFile
|
149
|
+
end # class Reporter
|
150
|
+
end # class Tester
|
151
|
+
end # module Webspicy
|
data/lib/webspicy/version.rb
CHANGED
data/tasks/test.rake
CHANGED
@@ -5,8 +5,12 @@ namespace :test do
|
|
5
5
|
|
6
6
|
desc "Runs unit tests on the library itself"
|
7
7
|
RSpec::Core::RakeTask.new(:unit) do |t|
|
8
|
+
require 'path'
|
9
|
+
root_folder = Path.dir.parent
|
10
|
+
test_results = root_folder/"test-results"
|
11
|
+
puts (test_results/"unit-tests.xml").inspect
|
8
12
|
t.pattern = "spec/unit/**/test_*.rb"
|
9
|
-
t.rspec_opts = ["-Ilib", "-Ispec/unit", "--color", "--backtrace", "--format=progress"]
|
13
|
+
t.rspec_opts = ["-Ilib", "-Ispec/unit", "--color", "--backtrace", "--format=progress", "--format RspecJunitFormatter", "--out #{test_results}/unit-tests.xml"]
|
10
14
|
end
|
11
15
|
tests << :unit
|
12
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webspicy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.
|
4
|
+
version: 0.20.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -198,11 +198,23 @@ dependencies:
|
|
198
198
|
- - "~>"
|
199
199
|
- !ruby/object:Gem::Version
|
200
200
|
version: 0.8.2
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: mustache
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - "~>"
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '1.0'
|
208
|
+
type: :runtime
|
209
|
+
prerelease: false
|
210
|
+
version_requirements: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - "~>"
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: '1.0'
|
201
215
|
description: Webspicy helps testing web services as software operation black boxes
|
202
216
|
email: blambeau@gmail.com
|
203
217
|
executables:
|
204
|
-
- sandr
|
205
|
-
- search
|
206
218
|
- webspicy
|
207
219
|
extensions: []
|
208
220
|
extra_rdoc_files: []
|
@@ -210,8 +222,6 @@ files:
|
|
210
222
|
- Gemfile
|
211
223
|
- README.md
|
212
224
|
- Rakefile
|
213
|
-
- bin/sandr
|
214
|
-
- bin/search
|
215
225
|
- bin/webspicy
|
216
226
|
- doc/1-black-box-scene.md
|
217
227
|
- doc/2-black-box-testing.md
|
@@ -263,6 +273,7 @@ files:
|
|
263
273
|
- lib/webspicy/tester/reporter/exceptions.rb
|
264
274
|
- lib/webspicy/tester/reporter/file_progress.rb
|
265
275
|
- lib/webspicy/tester/reporter/file_summary.rb
|
276
|
+
- lib/webspicy/tester/reporter/junit_xml_file.rb
|
266
277
|
- lib/webspicy/tester/reporter/progress.rb
|
267
278
|
- lib/webspicy/tester/reporter/success_or_not.rb
|
268
279
|
- lib/webspicy/tester/reporter/summary.rb
|
@@ -326,7 +337,7 @@ homepage: http://github.com/enspirit/webspicy
|
|
326
337
|
licenses:
|
327
338
|
- MIT
|
328
339
|
metadata: {}
|
329
|
-
post_install_message:
|
340
|
+
post_install_message:
|
330
341
|
rdoc_options: []
|
331
342
|
require_paths:
|
332
343
|
- lib
|
@@ -341,8 +352,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
341
352
|
- !ruby/object:Gem::Version
|
342
353
|
version: '0'
|
343
354
|
requirements: []
|
344
|
-
rubygems_version: 3.0.
|
345
|
-
signing_key:
|
355
|
+
rubygems_version: 3.0.8
|
356
|
+
signing_key:
|
346
357
|
specification_version: 4
|
347
358
|
summary: Webspicy helps testing web services as software operation black boxes!
|
348
359
|
test_files: []
|
data/bin/sandr
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'path'
|
3
|
-
|
4
|
-
def sandr(file)
|
5
|
-
file.write file.read.gsub(ARGV[0], ARGV[1])
|
6
|
-
end
|
7
|
-
|
8
|
-
Path.dir.parent.glob("lib/**/*.rb") do |file|
|
9
|
-
sandr(file)
|
10
|
-
end
|
11
|
-
|
12
|
-
Path.dir.parent.glob("spec/**/*.rb") do |file|
|
13
|
-
sandr(file)
|
14
|
-
end
|
data/bin/search
DELETED