rutema 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/lib/rutema/configuration.rb +13 -4
- data/lib/rutema/system.rb +3 -3
- data/test/test_couchdb.rb +41 -52
- metadata +7 -9
- data/test/test_rake.rb +0 -33
data/History.txt
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
== 1.2.1 /2011-04-04
|
2
|
+
* The configuration code no longer assumes that you are passing files. configuration.tests= now assumes you're passing an array of strings and it is the responsibility of the parser to make heads or tails from that. The configuraiton is clever enough to detect paths relative to the configuration file and expand them.
|
3
|
+
* some minor cosmetic changes in the documentation
|
1
4
|
== 1.2.0 /2011-04-01
|
2
5
|
* refactored library structure
|
3
6
|
* More unit tests. We're now over the magical 80% coverage point
|
data/lib/rutema/configuration.rb
CHANGED
@@ -78,10 +78,13 @@ module Rutema
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
-
#Adds the
|
82
|
-
|
81
|
+
#Adds the specification identifiers available to this instance of Rutema
|
82
|
+
#
|
83
|
+
#These will usually be files, but they can be anything.
|
84
|
+
#Essentially this is an Array of strings that mean something to your parser
|
85
|
+
def tests= array_of_identifiers
|
83
86
|
@tests||=Array.new
|
84
|
-
@tests+=
|
87
|
+
@tests+=array_of_identifiers
|
85
88
|
end
|
86
89
|
|
87
90
|
#A hash defining the parser to use.
|
@@ -150,7 +153,13 @@ module Rutema
|
|
150
153
|
raise Patir::ConfigurationException,"No parser defined" unless @configuration.parser
|
151
154
|
raise Patir::ConfigurationException,"Syntax error in parser definition - missing :class" unless @configuration.parser[:class]
|
152
155
|
@configuration.reporters=@reporters
|
153
|
-
@configuration.tests=@tests.collect
|
156
|
+
@configuration.tests=@tests.collect do |t|
|
157
|
+
if File.exists?(t)
|
158
|
+
File.expand_path(t)
|
159
|
+
else
|
160
|
+
t
|
161
|
+
end
|
162
|
+
end
|
154
163
|
@configuration.filename=@config_file
|
155
164
|
end
|
156
165
|
return @configuration
|
data/lib/rutema/system.rb
CHANGED
@@ -22,7 +22,7 @@ module Rutema
|
|
22
22
|
module Version
|
23
23
|
MAJOR=1
|
24
24
|
MINOR=2
|
25
|
-
TINY=
|
25
|
+
TINY=1
|
26
26
|
STRING=[ MAJOR, MINOR, TINY ].join( "." )
|
27
27
|
end
|
28
28
|
#This class coordinates parsing, execution and reporting of test specifications
|
@@ -233,7 +233,7 @@ module Rutema
|
|
233
233
|
def initialize command_line_args
|
234
234
|
parse_command_line(command_line_args)
|
235
235
|
@logger=Patir.setup_logger(@log_file)
|
236
|
-
@logger.info("
|
236
|
+
@logger.info("rutema v#{Version::STRING}")
|
237
237
|
begin
|
238
238
|
raise "No configuration file defined!" if !@config_file
|
239
239
|
@configuration=RutemaConfigurator.new(@config_file,@logger).configuration
|
@@ -262,7 +262,7 @@ module Rutema
|
|
262
262
|
opt.on("--log FILE", "-l FILE",String,"Redirects the log output to FILE") { |@log_file|}
|
263
263
|
opt.on("--check","Runs just the check test"){@check=true}
|
264
264
|
opt.on("--step","Runs test cases step by step"){@step=true}
|
265
|
-
opt.on("-v", "--version","Displays the version") { $stdout.puts("
|
265
|
+
opt.on("-v", "--version","Displays the version") { $stdout.puts("rutema v#{Version::STRING}");exit 0 }
|
266
266
|
opt.on("--help", "-h", "-?", "This text") { $stdout.puts opt; exit 0 }
|
267
267
|
opt.on("The commands are:")
|
268
268
|
opt.on("\tall - Runs all tests")
|
data/test/test_couchdb.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
2
|
require 'rubygems'
|
3
|
-
require 'rutema/gems'
|
4
3
|
require 'test/unit'
|
5
4
|
require 'ostruct'
|
6
5
|
require 'rutema/reporters/couchdb'
|
@@ -14,61 +13,51 @@ module TestRutema
|
|
14
13
|
@number=number
|
15
14
|
end
|
16
15
|
end
|
17
|
-
|
18
|
-
class TestCouchDBModel<Test::Unit::TestCase
|
19
|
-
def setup
|
20
|
-
@db=CouchRest.database!("http://localhost:5984/rutema_test")
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_couchdb_model
|
24
|
-
run=Rutema::CouchDB::Run.new
|
25
|
-
run.database=@db
|
26
|
-
run.context="context"
|
27
|
-
run.scenarios=["1","2","#{self.object_id}"]
|
28
|
-
assert_nothing_raised() { run.save }
|
29
|
-
|
30
|
-
r=Rutema::CouchDB::Run.get(run.slug)
|
31
|
-
assert_equal(run.slug, r.slug)
|
32
|
-
end
|
33
|
-
end
|
34
16
|
|
35
17
|
class TestCouchDBReporter<Test::Unit::TestCase
|
36
18
|
CFG={:db=>{:url=>"http://localhost:5984", :database=>"rutema_test_sandbox"}}
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
19
|
+
def setup
|
20
|
+
@parse_errors=[{:filename=>"f.spec",:error=>"error"}]
|
21
|
+
st=Patir::CommandSequenceStatus.new("test_seq")
|
22
|
+
st.step=MockCommand.new(1)
|
23
|
+
st.step=MockCommand.new(2)
|
24
|
+
st.step=MockCommand.new(3)
|
25
|
+
@status=[st]
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_no_errors
|
29
|
+
spec=mock
|
30
|
+
db=mock
|
31
|
+
Rutema::CouchDB.expects(:connect).returns(db)
|
32
|
+
db.expects(:save_doc).returns({})
|
33
|
+
r=Rutema::CouchDBReporter.new(CFG)
|
34
|
+
assert_nothing_raised() { r.report({"test"=>spec},[runner_state_mock()],[],nil) }
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_a_bit_of_everything
|
38
|
+
spec=mock
|
39
|
+
spec.expects(:has_version?).returns(false)
|
40
|
+
spec.expects(:title).returns("T")
|
41
|
+
spec.expects(:description).returns("cool test")
|
42
|
+
db=mock
|
43
|
+
Rutema::CouchDB.expects(:connect).returns(db)
|
44
|
+
db.expects(:save_doc).returns({})
|
51
45
|
|
52
|
-
|
53
|
-
spec=mock
|
54
|
-
spec.expects(:has_version?).returns(false)
|
55
|
-
spec.expects(:title).returns("T")
|
56
|
-
spec.expects(:description).returns("cool test")
|
57
|
-
|
58
|
-
r=Rutema::CouchDBReporter.new(CFG)
|
59
|
-
assert_nothing_raised() { r.report({"1"=>spec},[runner_state_mock,runner_state_mock(1,:error)],[],nil) }
|
60
|
-
end
|
46
|
+
r=Rutema::CouchDBReporter.new(CFG)
|
61
47
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
48
|
+
assert_nothing_raised() { r.report({"1"=>spec},[runner_state_mock,runner_state_mock(1,:error)],[],nil) }
|
49
|
+
end
|
50
|
+
|
51
|
+
def runner_state_mock n=0,status=:success,step_states=[]
|
52
|
+
rs=mock()
|
53
|
+
rs.expects(:sequence_name).returns("#{n}")
|
54
|
+
rs.expects(:sequence_id).returns("seq_id#{n}")
|
55
|
+
rs.expects(:start_time).returns(Time.now-3600)
|
56
|
+
rs.expects(:stop_time).returns(Time.now)
|
57
|
+
rs.expects(:status).returns(status)
|
58
|
+
rs.expects(:strategy).returns(:attended)
|
59
|
+
rs.expects(:step_states).returns(step_states)
|
60
|
+
return rs
|
61
|
+
end
|
73
62
|
end
|
74
63
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rutema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 1
|
10
|
+
version: 1.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Vassilis Rizopoulos
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-04 00:00:00 +03:00
|
19
19
|
default_executable: rutema
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -122,12 +122,12 @@ dependencies:
|
|
122
122
|
requirements:
|
123
123
|
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
hash:
|
125
|
+
hash: 35
|
126
126
|
segments:
|
127
127
|
- 2
|
128
128
|
- 9
|
129
|
-
-
|
130
|
-
version: 2.9.
|
129
|
+
- 4
|
130
|
+
version: 2.9.4
|
131
131
|
type: :development
|
132
132
|
version_requirements: *id007
|
133
133
|
description: |-
|
@@ -219,7 +219,6 @@ files:
|
|
219
219
|
- test/test_runners.rb
|
220
220
|
- test/test_system.rb
|
221
221
|
- test/test_couchdb.rb
|
222
|
-
- test/test_rake.rb
|
223
222
|
- .gemtest
|
224
223
|
has_rdoc: true
|
225
224
|
homepage: http://patir.rubyforge.org/rutema
|
@@ -262,7 +261,6 @@ test_files:
|
|
262
261
|
- test/test_couchdb.rb
|
263
262
|
- test/test_objectmodel.rb
|
264
263
|
- test/test_parsers.rb
|
265
|
-
- test/test_rake.rb
|
266
264
|
- test/test_reporters.rb
|
267
265
|
- test/test_runners.rb
|
268
266
|
- test/test_system.rb
|
data/test/test_rake.rb
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
|
-
require 'test/unit'
|
3
|
-
require 'rubygems'
|
4
|
-
require 'rake'
|
5
|
-
require 'rutema/rake'
|
6
|
-
|
7
|
-
module TestRutema
|
8
|
-
class TestRakeTask<Test::Unit::TestCase
|
9
|
-
def test_rake_task
|
10
|
-
t=nil
|
11
|
-
assert_nothing_raised() { t=Rutema::RakeTask.new(:config_file=>"rutema.rutema") }
|
12
|
-
assert_not_nil(t)
|
13
|
-
assert_equal("rutema", t.rake_task.name)
|
14
|
-
assert_equal([], t.rake_task.prerequisites)
|
15
|
-
assert_nothing_raised() { t.add_dependency("some_task") }
|
16
|
-
assert_equal(["some_task"], t.rake_task.prerequisites)
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_rake_task_block
|
20
|
-
t=nil
|
21
|
-
assert_nothing_raised() { t=Rutema::RakeTask.new do |rt|
|
22
|
-
rt.name="test"
|
23
|
-
rt.config_file="rutema.rutema"
|
24
|
-
rt.add_dependency("some_task")
|
25
|
-
end }
|
26
|
-
assert_equal("rutema:test", t.rake_task.name)
|
27
|
-
assert_equal(["some_task"], t.rake_task.prerequisites)
|
28
|
-
assert_nothing_raised() { t.add_dependency(:symbol_task) }
|
29
|
-
assert_nothing_raised() { t.add_dependency(:"ns:symbol_task") }
|
30
|
-
assert_equal(["some_task","symbol_task","ns:symbol_task"], t.rake_task.prerequisites)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|