rutema 1.1.3 → 1.2.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.
- data/.gemtest +0 -0
- data/History.txt +5 -0
- data/Manifest.txt +28 -23
- data/README.md +91 -0
- data/README.txt +2 -10
- data/Rakefile +6 -9
- data/bin/rutema +9 -0
- data/bin/rutemax +2 -0
- data/lib/rutema/configuration.rb +7 -8
- data/lib/rutema/elements/minimal.rb +45 -0
- data/lib/rutema/gems.rb +3 -3
- data/lib/rutema/models/activerecord.rb +164 -0
- data/lib/rutema/models/base.rb +5 -0
- data/lib/rutema/{specification.rb → objectmodel.rb} +4 -10
- data/lib/rutema/parsers/base.rb +29 -0
- data/lib/rutema/parsers/xml.rb +186 -0
- data/lib/rutema/reporters/activerecord.rb +9 -18
- data/lib/rutema/{reporter.rb → reporters/base.rb} +3 -7
- data/lib/rutema/reporters/email.rb +2 -5
- data/lib/rutema/reporters/text.rb +2 -2
- data/lib/rutema/reporters/yaml.rb +1 -2
- data/lib/rutema/runners/default.rb +157 -0
- data/lib/rutema/runners/step.rb +23 -0
- data/lib/rutema/system.rb +15 -420
- data/test/distro_test/config/full.rutema +2 -0
- data/test/distro_test/specs/check.spec +8 -0
- data/test/distro_test/specs/duplicate_name.spec +8 -0
- data/test/distro_test/specs/fail.spec +9 -0
- data/test/distro_test/specs/setup.spec +8 -0
- data/test/distro_test/specs/teardown.spec +8 -0
- data/test/rutema.rutema +1 -1
- data/test/rutema.spec +5 -5
- data/test/test_activerecord.rb +0 -0
- data/test/test_configuration.rb +7 -9
- data/test/test_couchdb.rb +14 -0
- data/test/{test_specification.rb → test_objectmodel.rb} +8 -11
- data/test/test_parsers.rb +136 -0
- data/test/test_rake.rb +2 -3
- data/test/{test_reporter.rb → test_reporters.rb} +0 -0
- data/test/test_runners.rb +72 -0
- data/test/test_system.rb +3 -166
- metadata +57 -62
- data/bin/rutema_upgrader +0 -81
- data/distro_test.sh +0 -6
- data/lib/rutema/model.rb +0 -231
- data/lib/rutema/reporters/couchdb.rb +0 -62
- data/lib/rutema/reporters/standard_reporters.rb +0 -7
- data/selftest.sh +0 -2
- data/test/data/sample09.db +0 -0
- data/test/migration.spec +0 -9
- data/test/test_model.rb +0 -62
@@ -1,62 +0,0 @@
|
|
1
|
-
require 'rutema/model'
|
2
|
-
|
3
|
-
module Rutema
|
4
|
-
class CouchDBReporter
|
5
|
-
def initialize definition
|
6
|
-
@logger=definition[:logger]
|
7
|
-
@logger||=Patir.setup_logger
|
8
|
-
database_configuration = definition[:db]
|
9
|
-
raise "No database configuration defined, missing :db configuration key." unless database_configuration
|
10
|
-
@database=Rutema::CouchDB.connect(database_configuration,@logger)
|
11
|
-
@logger.info("Reporter #{self.to_s} registered")
|
12
|
-
end
|
13
|
-
|
14
|
-
#We get all the data for a Rutema::CouchDB::Model::Run entry in here.
|
15
|
-
def report specifications,runner_states,parse_errors,configuration
|
16
|
-
run_entry=Rutema::CouchDB::Model::Run.new
|
17
|
-
run_entry.database=@database
|
18
|
-
if configuration && configuration.context
|
19
|
-
run_entry.context=configuration.context
|
20
|
-
end
|
21
|
-
run_entry.parse_errors=parse_errors
|
22
|
-
scenarios=[]
|
23
|
-
runner_states.compact!
|
24
|
-
runner_states.each { |scenario| scenarios<<format_scenario(scenario,specifications)}
|
25
|
-
run_entry.scenarios=scenarios
|
26
|
-
run_entry.save
|
27
|
-
"couchdb reporter done"
|
28
|
-
end
|
29
|
-
|
30
|
-
def to_s
|
31
|
-
"CouchDBReporter"
|
32
|
-
end
|
33
|
-
private
|
34
|
-
def format_scenario scenario,specifications
|
35
|
-
sc={}
|
36
|
-
sc[:name]=scenario.sequence_name
|
37
|
-
sc[:number]=scenario.sequence_id
|
38
|
-
sc[:start_time]=scenario.start_time
|
39
|
-
sc[:stop_time]=scenario.stop_time
|
40
|
-
sc[:status]=scenario.status.to_s
|
41
|
-
#get the specification for this scenario
|
42
|
-
spec=specifications[sc[:name]]
|
43
|
-
if spec
|
44
|
-
sc[:version]=spec.version if spec.has_version?
|
45
|
-
sc[:title]=spec.title
|
46
|
-
sc[:description]=spec.description
|
47
|
-
else
|
48
|
-
@logger.debug("Could not find specification for #{sc[:name]}")
|
49
|
-
|
50
|
-
sc[:title]=sc[:name]
|
51
|
-
sc[:description]=""
|
52
|
-
end
|
53
|
-
if scenario.strategy==:attended
|
54
|
-
sc[:attended]=true
|
55
|
-
else
|
56
|
-
sc[:attended]=false
|
57
|
-
end
|
58
|
-
sc[:steps]=scenario.step_states
|
59
|
-
return sc
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Copyright (c) 2007-2010 Vassilis Rizopoulos. All rights reserved.
|
2
|
-
$:.unshift File.join(File.dirname(__FILE__),"..","..")
|
3
|
-
|
4
|
-
require 'rutema/reporters/text'
|
5
|
-
require 'rutema/reporters/email'
|
6
|
-
require 'rutema/reporters/activerecord'
|
7
|
-
require 'rutema/reporters/yaml'
|
data/selftest.sh
DELETED
data/test/data/sample09.db
DELETED
Binary file
|
data/test/migration.spec
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
<specification name="TR002">
|
2
|
-
<title>Migration v0.9 to v1.0</title>
|
3
|
-
<description>Test that the database migration code is succesfull between versions 0.9.0 and 1.0.0</description>
|
4
|
-
<scenario>
|
5
|
-
<command cmd="cp data/sample09.db data/test.db"/>
|
6
|
-
<command cmd="rutema_upgrader data/migration.rutema"/>
|
7
|
-
<command cmd="rm data/test.db"/>
|
8
|
-
</scenario>
|
9
|
-
</specification>
|
data/test/test_model.rb
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
|
2
|
-
require 'rubygems'
|
3
|
-
require 'test/unit'
|
4
|
-
require 'rutema/model'
|
5
|
-
require 'fileutils'
|
6
|
-
require 'rubygems'
|
7
|
-
require 'rutema/gems'
|
8
|
-
|
9
|
-
module TestRutema
|
10
|
-
class TestActiveRecordModel<Test::Unit::TestCase
|
11
|
-
def setup
|
12
|
-
ActiveRecord::Base.establish_connection(:adapter => "sqlite3",:database =>":memory:")
|
13
|
-
Rutema::ActiveRecord::Model::Schema.up
|
14
|
-
end
|
15
|
-
def teardown
|
16
|
-
ActiveRecord::Base.remove_connection
|
17
|
-
FileUtils.rm_rf("db/") if File.exists?("db/")
|
18
|
-
end
|
19
|
-
#test the CRUD operations
|
20
|
-
def test_create_read_update_delete
|
21
|
-
#create
|
22
|
-
r=Rutema::ActiveRecord::Model::Run.new
|
23
|
-
context={:tester=>"automatopoulos",:version=>"latest"}
|
24
|
-
r.context=context
|
25
|
-
sc=Rutema::ActiveRecord::Model::Scenario.new(:name=>"TC000",:attended=>false,:status=>"success",:start_time=>Time.now)
|
26
|
-
sc.steps<<Rutema::ActiveRecord::Model::Step.new(:name=>"echo",:number=>1,:status=>"success",:output=>"testing is nice",:error=>"",:duration=>1)
|
27
|
-
r.scenarios<<sc
|
28
|
-
assert(r.save, "Failed to save.")
|
29
|
-
#read
|
30
|
-
run=Rutema::ActiveRecord::Model::Run.find(r.id)
|
31
|
-
assert_equal(context,run.context)
|
32
|
-
assert_equal(sc.name, run.scenarios[0].name)
|
33
|
-
#update
|
34
|
-
new_context={:tester=>"tempelopoulos"}
|
35
|
-
run.context=new_context
|
36
|
-
assert(run.save, "Failed to update.")
|
37
|
-
#delete
|
38
|
-
assert(run.destroy, "Failed to delete.")
|
39
|
-
assert_raise(ActiveRecord::RecordNotFound) {Rutema::ActiveRecord::Model::Run.find(r.id)}
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
class TestCouchDBModel<Test::Unit::TestCase
|
44
|
-
def setup
|
45
|
-
@db=CouchRest.database!("http://localhost:5984/rutema_test")
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_couchdb_model
|
49
|
-
run=Rutema::CouchDB::Model::Run.new
|
50
|
-
run.database=@db
|
51
|
-
run.context="context"
|
52
|
-
run.scenarios=["1","2","#{self.object_id}"]
|
53
|
-
assert_nothing_raised() { run.save }
|
54
|
-
|
55
|
-
r=Rutema::CouchDB::Model::Run.get(run.slug)
|
56
|
-
assert_equal(run.slug, r.slug)
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
end
|
62
|
-
end
|