dtest 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -6
- data/VERSION +1 -1
- data/bin/dtest +1 -0
- data/examples/sample2.rb +11 -0
- data/lib/dtest.rb +14 -0
- data/lib/dtest/command.rb +3 -11
- data/lib/dtest/core.rb +18 -12
- data/lib/dtest/failure.rb +0 -3
- data/lib/dtest/report.rb +2 -5
- data/lib/dtest/runner.rb +18 -1
- data/lib/dtest/version.rb +1 -1
- data/spec/spec_helper.rb +7 -0
- data/spec/test_abort_spec.rb +1 -5
- data/spec/test_assert_spec.rb +1 -3
- data/spec/test_command1_spec.rb +33 -0
- data/spec/test_command2_spec.rb +11 -0
- data/spec/test_exception_spec.rb +1 -2
- data/spec/test_expect_spec.rb +1 -2
- data/spec/test_spec.rb +1 -2
- data/spec/test_value_parameterized_spec.rb +1 -2
- metadata +14 -7
data/Rakefile
CHANGED
@@ -10,12 +10,6 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
10
10
|
spec.ruby_opts = ['-rubygems'] if defined? Gem
|
11
11
|
end
|
12
12
|
|
13
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
14
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
15
|
-
spec.ruby_opts = ['-rubygems'] if defined? Gem
|
16
|
-
spec.rcov = true
|
17
|
-
end
|
18
|
-
|
19
13
|
task :default => :spec
|
20
14
|
|
21
15
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/bin/dtest
CHANGED
data/examples/sample2.rb
ADDED
data/lib/dtest.rb
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'dtest/runner'
|
2
|
+
require 'dtest/dsl'
|
3
|
+
|
4
|
+
at_exit do
|
5
|
+
# parse and run
|
6
|
+
option = DTest::Runner.parse!(ARGV)
|
7
|
+
res = DTest::Runner.run
|
8
|
+
DTest::Runner.report(res)
|
9
|
+
# output xml
|
10
|
+
if option[:xml_path]
|
11
|
+
res.outputxml(option[:xml_path])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
data/lib/dtest/command.rb
CHANGED
@@ -11,23 +11,15 @@ if ARGV.empty?
|
|
11
11
|
usage
|
12
12
|
else
|
13
13
|
# Command line parser
|
14
|
-
|
15
|
-
opt = OptionParser.new
|
16
|
-
opt.on('--color') do |b|
|
17
|
-
DTest::Report.color_enabled = b
|
18
|
-
end
|
19
|
-
opt.on('--xml PATH') do |path|
|
20
|
-
xml_path = path
|
21
|
-
end
|
22
|
-
opt.parse!(ARGV)
|
14
|
+
option = DTest::Runner.parse!(ARGV)
|
23
15
|
|
24
16
|
# execute test
|
25
17
|
res = DTest::Runner.run(ARGV)
|
26
18
|
DTest::Runner.report(res)
|
27
19
|
|
28
20
|
# output xml
|
29
|
-
if xml_path
|
30
|
-
res.outputxml(xml_path)
|
21
|
+
if option[:xml_path]
|
22
|
+
res.outputxml(option[:xml_path])
|
31
23
|
end
|
32
24
|
end
|
33
25
|
|
data/lib/dtest/core.rb
CHANGED
@@ -156,24 +156,30 @@ module DTest
|
|
156
156
|
|
157
157
|
# abort
|
158
158
|
def abort_if(condition, message = nil)
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
159
|
+
if condition
|
160
|
+
str = "Abort"
|
161
|
+
str += ": #{message}\n" if message
|
162
|
+
failed(str)
|
163
|
+
raise AbortTest.new(str)
|
164
|
+
end
|
163
165
|
end
|
164
166
|
|
165
167
|
def abort_case_if(condition, message = nil)
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
168
|
+
if condition
|
169
|
+
str = "Abort TestCase"
|
170
|
+
str += ": #{message}\n" if message
|
171
|
+
failed(str)
|
172
|
+
raise AbortTestCase.new(str)
|
173
|
+
end
|
170
174
|
end
|
171
175
|
|
172
176
|
def abort_global_if(condition, message = nil)
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
+
if condition
|
178
|
+
str = "Abort global"
|
179
|
+
str += ": #{message}\n" if message
|
180
|
+
failed(str)
|
181
|
+
raise AbortGlobal.new(str)
|
182
|
+
end
|
177
183
|
end
|
178
184
|
|
179
185
|
private #internal methods
|
data/lib/dtest/failure.rb
CHANGED
data/lib/dtest/report.rb
CHANGED
data/lib/dtest/runner.rb
CHANGED
@@ -1,11 +1,28 @@
|
|
1
1
|
|
2
2
|
|
3
|
+
require 'optparse'
|
3
4
|
require 'dtest/core'
|
4
5
|
require 'dtest/progress'
|
5
6
|
|
6
7
|
module DTest
|
7
8
|
class Runner
|
8
|
-
def self.
|
9
|
+
def self.parse!(argv)
|
10
|
+
# Command line parser
|
11
|
+
res = {}
|
12
|
+
xml_path = nil
|
13
|
+
opt = OptionParser.new
|
14
|
+
opt.on('--color') do |b|
|
15
|
+
DTest::Report.color_enabled = b
|
16
|
+
end
|
17
|
+
opt.on('--xml PATH') do |path|
|
18
|
+
res[:xml_path] = path
|
19
|
+
end
|
20
|
+
opt.parse!(ARGV)
|
21
|
+
|
22
|
+
res
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.run(files = [])
|
9
26
|
files.each do |file|
|
10
27
|
load file
|
11
28
|
end
|
data/lib/dtest/version.rb
CHANGED
data/spec/spec_helper.rb
ADDED
data/spec/test_abort_spec.rb
CHANGED
data/spec/test_assert_spec.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path(File.join('.', 'spec_helper'), File.dirname(__FILE__))
|
2
|
+
|
3
|
+
ARGV = []
|
4
|
+
|
5
|
+
Dir::glob(File.dirname(__FILE__) + "/dtest/*.rb").each {|f|
|
6
|
+
ARGV << f
|
7
|
+
}
|
8
|
+
|
9
|
+
def exec_cmd
|
10
|
+
begin
|
11
|
+
load 'dtest/command.rb'
|
12
|
+
ensure
|
13
|
+
DTest::Global::Manager.instance.clear
|
14
|
+
DTest::Test::Manager.instance.clear
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# execute dtest 1(without color, no output xml)
|
19
|
+
exec_cmd
|
20
|
+
|
21
|
+
# execute dtest 2(with color, output xml)
|
22
|
+
require 'tempfile'
|
23
|
+
temp = Tempfile.new('foo')
|
24
|
+
begin
|
25
|
+
temp.close
|
26
|
+
ARGV.insert(0, '--xml')
|
27
|
+
ARGV.insert(1, temp.path)
|
28
|
+
ARGV << '--color'
|
29
|
+
exec_cmd
|
30
|
+
ensure
|
31
|
+
temp.unlink
|
32
|
+
end
|
33
|
+
|
data/spec/test_exception_spec.rb
CHANGED
data/spec/test_expect_spec.rb
CHANGED
data/spec/test_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dtest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-09 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70104550738940 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70104550738940
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70104550738480 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 1.2.3
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70104550738480
|
36
36
|
description: DTest is a testing tool to describe integrating test for distributed
|
37
37
|
systems.
|
38
38
|
email: suma@sourceforge.jp
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- bin/dtest
|
50
50
|
- dtest.gemspec
|
51
51
|
- examples/sample.rb
|
52
|
+
- examples/sample2.rb
|
52
53
|
- lib/dtest.rb
|
53
54
|
- lib/dtest/command.rb
|
54
55
|
- lib/dtest/core.rb
|
@@ -62,8 +63,11 @@ files:
|
|
62
63
|
- lib/dtest/test.rb
|
63
64
|
- lib/dtest/util.rb
|
64
65
|
- lib/dtest/version.rb
|
66
|
+
- spec/spec_helper.rb
|
65
67
|
- spec/test_abort_spec.rb
|
66
68
|
- spec/test_assert_spec.rb
|
69
|
+
- spec/test_command1_spec.rb
|
70
|
+
- spec/test_command2_spec.rb
|
67
71
|
- spec/test_exception_spec.rb
|
68
72
|
- spec/test_expect_spec.rb
|
69
73
|
- spec/test_spec.rb
|
@@ -88,13 +92,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
92
|
version: '0'
|
89
93
|
requirements: []
|
90
94
|
rubyforge_project:
|
91
|
-
rubygems_version: 1.8.
|
95
|
+
rubygems_version: 1.8.10
|
92
96
|
signing_key:
|
93
97
|
specification_version: 3
|
94
98
|
summary: DTest is a testing tool to describe integrating test for distributed systems.
|
95
99
|
test_files:
|
100
|
+
- spec/spec_helper.rb
|
96
101
|
- spec/test_abort_spec.rb
|
97
102
|
- spec/test_assert_spec.rb
|
103
|
+
- spec/test_command1_spec.rb
|
104
|
+
- spec/test_command2_spec.rb
|
98
105
|
- spec/test_exception_spec.rb
|
99
106
|
- spec/test_expect_spec.rb
|
100
107
|
- spec/test_spec.rb
|