rutema 1.3.0 → 2.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/History.txt +204 -194
- data/Manifest.txt +15 -48
- data/README.md +55 -61
- data/bin/rutema +7 -7
- data/lib/rutema/application.rb +61 -0
- data/lib/rutema/core/configuration.rb +195 -0
- data/lib/rutema/core/engine.rb +186 -0
- data/lib/rutema/core/framework.rb +28 -0
- data/lib/rutema/{objectmodel.rb → core/objectmodel.rb} +43 -48
- data/lib/rutema/core/parser.rb +35 -0
- data/lib/rutema/core/reporter.rb +105 -0
- data/lib/rutema/core/runner.rb +83 -0
- data/lib/rutema/elements/minimal.rb +47 -44
- data/lib/rutema/parsers/xml.rb +154 -186
- data/lib/rutema/version.rb +9 -0
- metadata +39 -108
- data/README.txt +0 -44
- data/Rakefile +0 -30
- data/examples/README.md +0 -17
- data/examples/config/database.rutema +0 -17
- data/examples/config/full.rutema +0 -27
- data/examples/config/minimal.rutema +0 -10
- data/examples/specs/T001.spec +0 -8
- data/examples/specs/T002.spec +0 -8
- data/examples/specs/T003.spec +0 -8
- data/examples/specs/T004.spec +0 -8
- data/examples/specs/T005.spec +0 -10
- data/examples/specs/T006.spec +0 -9
- data/examples/specs/check.spec +0 -8
- data/examples/specs/fail.spec +0 -9
- data/examples/specs/include.scenario +0 -5
- data/examples/specs/rutema.spec +0 -10
- data/examples/specs/setup.spec +0 -8
- data/examples/specs/teardown.spec +0 -8
- data/lib/rutema/configuration.rb +0 -173
- data/lib/rutema/models/activerecord.rb +0 -159
- data/lib/rutema/models/base.rb +0 -5
- data/lib/rutema/parsers/base.rb +0 -45
- data/lib/rutema/rake.rb +0 -62
- data/lib/rutema/reporters/activerecord.rb +0 -82
- data/lib/rutema/reporters/base.rb +0 -23
- data/lib/rutema/reporters/email.rb +0 -84
- data/lib/rutema/reporters/text.rb +0 -77
- data/lib/rutema/runners/default.rb +0 -157
- data/lib/rutema/runners/step.rb +0 -23
- data/lib/rutema/system.rb +0 -302
- data/test/data/duplicate_name.spec +0 -8
- data/test/data/no_title.spec +0 -5
- data/test/data/sample.spec +0 -8
- data/test/data/test_identifiers.rutema +0 -7
- data/test/test_activerecord.rb +0 -0
- data/test/test_configuration.rb +0 -43
- data/test/test_objectmodel.rb +0 -82
- data/test/test_parsers.rb +0 -131
- data/test/test_reporters.rb +0 -115
- data/test/test_runners.rb +0 -70
- data/test/test_system.rb +0 -45
data/README.txt
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
rutema http://patir.rubyforge.org/rutema
|
2
|
-
|
3
|
-
== DESCRIPTION:
|
4
|
-
rutema is a test execution tool with a twist.
|
5
|
-
It allows you to combine test tools while it takes care of logging, reporting, archiving of results and formalizes execution of automated and manual tests.
|
6
|
-
It's purpose is to make testing in heterogeneous environments easier.
|
7
|
-
|
8
|
-
For more information look at http://patir.rubyforge.org/rutema
|
9
|
-
|
10
|
-
== FEATURES/PROBLEMS:
|
11
|
-
* Unified test execution environment for automated and manual tests
|
12
|
-
* Extensible reports and notifications in various formats (email, rss, pdf, html etc.)
|
13
|
-
* Comprehensive history of test execution
|
14
|
-
* A well defined way to create a project specific test specification format
|
15
|
-
|
16
|
-
== SYNOPSIS:
|
17
|
-
See http://patir.rubyforge.org/rutema/examples.html for an introductory example.
|
18
|
-
|
19
|
-
== INSTALL:
|
20
|
-
* gem install rutema
|
21
|
-
|
22
|
-
== LICENSE:
|
23
|
-
(The MIT License)
|
24
|
-
|
25
|
-
Copyright (c) 2007-2012 Vassilis Rizopoulos
|
26
|
-
|
27
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
28
|
-
a copy of this software and associated documentation files (the
|
29
|
-
'Software'), to deal in the Software without restriction, including
|
30
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
31
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
32
|
-
permit persons to whom the Software is furnished to do so, subject to
|
33
|
-
the following conditions:
|
34
|
-
|
35
|
-
The above copyright notice and this permission notice shall be
|
36
|
-
included in all copies or substantial portions of the Software.
|
37
|
-
|
38
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
39
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
40
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
41
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
42
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
43
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
44
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# Copyright (c) 2007-2010 Vassilis Rizopoulos. All rights reserved.
|
2
|
-
# -*- ruby -*-
|
3
|
-
$:.unshift File.join(File.dirname(__FILE__),"lib")
|
4
|
-
require 'hoe'
|
5
|
-
require 'rutema/system'
|
6
|
-
|
7
|
-
Hoe.spec('rutema') do |p|
|
8
|
-
p.version=Rutema::Version::STRING
|
9
|
-
p.rubyforge_name = 'patir'
|
10
|
-
p.author = "Vassilis Rizopoulos"
|
11
|
-
p.email = "vassilisrizopoulos@gmail.com"
|
12
|
-
p.summary = 'rutema is a test execution and management framework for heterogeneous testing environments'
|
13
|
-
p.description = p.paragraphs_of('README.md', 1..4).join("\n\n")
|
14
|
-
p.urls= ["http://github.com/damphyr/rutema"]
|
15
|
-
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
16
|
-
p.extra_deps<<["patir", "~>0.8.0"]
|
17
|
-
p.extra_deps<<["highline","~>1.6.15"]
|
18
|
-
p.extra_deps<<["mailfactory","~>1.4.0"]
|
19
|
-
p.spec_extras={:executables=>["rutema"]}
|
20
|
-
end
|
21
|
-
|
22
|
-
task :default =>[:test,:system_tests]
|
23
|
-
|
24
|
-
task :system_tests do
|
25
|
-
Dir.chdir(File.join(File.dirname(__FILE__),'examples')) do
|
26
|
-
sh('./system_test.sh')
|
27
|
-
end
|
28
|
-
end
|
29
|
-
# vim: syntax=Ruby
|
30
|
-
|
data/examples/README.md
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
## rutema examples
|
2
|
-
The examples included herein are also used to test the rutema functionality, so you know they work.
|
3
|
-
|
4
|
-
## Structure
|
5
|
-
The basic structure we follow in rutema usage (and this has been "in production" for a good 5 years now) is a config/ directory where each suite is configured, a specs/ directory to store the test specifications and a scritps/ directory for any scripts and data files used by the steps in the scripts directory.
|
6
|
-
|
7
|
-
We also usually add any custom code used in the configuration files in config/lib so that it can be required in the configuration files without much trouble.
|
8
|
-
|
9
|
-
##Rutema configuration
|
10
|
-
rutema is a modular system made up of two types of modules: parser and reporter.
|
11
|
-
|
12
|
-
Customizing the behaviour of rutema involves specifying a parser to use for parsing test specifications and one or more reporters to handle the test results.
|
13
|
-
|
14
|
-
Some examples:
|
15
|
-
* [The absolute minimum](https://github.com/damphyr/rutema/blob/master/examples/config/minimal.rutema)
|
16
|
-
* [Storing results in an active record database](https://github.com/damphyr/rutema/blob/master/examples/config/database.rutema)
|
17
|
-
* [Specify setup, teardown and check scripts](https://github.com/damphyr/rutema/blob/master/examples/config/full.rutema)
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'rutema/parsers/xml'
|
2
|
-
require 'rutema/reporters/activerecord'
|
3
|
-
#The parser to use
|
4
|
-
configuration.parser={:class=>Rutema::MinimalXMLParser}
|
5
|
-
#Use the AR-Reporter.
|
6
|
-
#In case of reporters the whole Hash is passed to the reporter initializer, so any keys are dependent on the reporter to use
|
7
|
-
#Check the appropriate RDoc entries
|
8
|
-
#Also note that any relative paths are relative to __the location of the configuration file__
|
9
|
-
configuration.reporter={:class=>Rutema::ActiveRecordReporter, :db=>{:adapter=>"sqlite3",:database=>"../example.db"}}
|
10
|
-
configuration.tests=[
|
11
|
-
"../specs/T001.spec",
|
12
|
-
"../specs/T002.spec",
|
13
|
-
"../specs/T003.spec",
|
14
|
-
"../specs/T004.spec",
|
15
|
-
"../specs/T005.spec",
|
16
|
-
"../specs/T006.spec"
|
17
|
-
]
|
data/examples/config/full.rutema
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'rutema/parsers/xml'
|
2
|
-
require 'rutema/reporters/activerecord'
|
3
|
-
#Configures the parser to use. You can only use one parser and the last entry wins
|
4
|
-
configuration.parser={:class=>Rutema::MinimalXMLParser}
|
5
|
-
#Configures the reporters to use. You can define as many reporters as you wish (there are stdout, email, active record and couchdb reporters included). The Hash defined here is passed in it's entirety over to the reporter so each reporter defines different keys.
|
6
|
-
#Check each reporter's RDoc entry for details
|
7
|
-
configuration.reporter={:class=>Rutema::ActiveRecordReporter, :db=>{:adapter=>"sqlite3",:database=>"sample.db"}}
|
8
|
-
configuration.tests=[
|
9
|
-
"../specs/T001.spec",
|
10
|
-
"../specs/T002.spec",
|
11
|
-
"../specs/T003.spec",
|
12
|
-
"../specs/T004.spec",
|
13
|
-
"../specs/T005.spec",
|
14
|
-
"../specs/T006.spec"
|
15
|
-
]
|
16
|
-
#This is a way to centrally configure tools and commands used to implement test steps.
|
17
|
-
#When building command lines for test steps in the parser it is a good idea to have things like paths, IP addresses and other environment specific parameters in a single place. Using tool= and path= entries you can then access this information in the parser i.e. configuration.tool.test[:path]
|
18
|
-
configuration.tool={:name=>"test",:path=>".",:configuration=>{:key=>"value"}}
|
19
|
-
configuration.path={:name=>"test",:path=>"."}
|
20
|
-
#The context Hash is used to pass general information to the rutema components (parser, runner, reporters). It's the easiest way to pass versioning information etc. Since the configuration file is Ruby code nothing prevents you from programmatically generating the context content here.
|
21
|
-
configuration.context={:key=>"value"}
|
22
|
-
#The test specification that runs as a sanity check before the entire suite. If it fails then the rest of the tests are not executed
|
23
|
-
configuration.check="../specs/check.spec"
|
24
|
-
#Teardown script
|
25
|
-
configuration.teardown="../specs/teardown.spec"
|
26
|
-
#Setup script
|
27
|
-
configuration.setup="../specs/setup.spec"
|
data/examples/specs/T001.spec
DELETED
data/examples/specs/T002.spec
DELETED
data/examples/specs/T003.spec
DELETED
data/examples/specs/T004.spec
DELETED
data/examples/specs/T005.spec
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<specification name="T005">
|
3
|
-
<title>T005</title>
|
4
|
-
<description>Test the include_scenario element</description>
|
5
|
-
<scenario>
|
6
|
-
<echo>We can now include scenarios in standalone files</echo>
|
7
|
-
<include_scenario file="include.scenario"/>
|
8
|
-
<echo>This is the 4th step</echo>
|
9
|
-
</scenario>
|
10
|
-
</specification>
|
data/examples/specs/T006.spec
DELETED
data/examples/specs/check.spec
DELETED
data/examples/specs/fail.spec
DELETED
data/examples/specs/rutema.spec
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
<specification name="TR001">
|
2
|
-
<title>Rutema self hosting test</title>
|
3
|
-
<description>Test that rutema is usable as a step in a specification using the distro test example</description>
|
4
|
-
<scenario>
|
5
|
-
<command cmd="bundle exec ruby -I../../lib ../../bin/rutema -c ../config/minimal.rutema"/>
|
6
|
-
<command cmd="bundle exec ruby -I../../lib ../../bin/rutema -c ../config/database.rutema"/>
|
7
|
-
<command cmd="bundle exec ruby -I../../lib ../../bin/rutema -c ../config/database.rutema ../specs/T001.spec"/>
|
8
|
-
<command cmd="bundle exec ruby -I../../lib ../../bin/rutema -c ../config/full.rutema"/>
|
9
|
-
</scenario>
|
10
|
-
</specification>
|
data/examples/specs/setup.spec
DELETED
data/lib/rutema/configuration.rb
DELETED
@@ -1,173 +0,0 @@
|
|
1
|
-
# Copyright (c) 2007-2010 Vassilis Rizopoulos. All rights reserved.
|
2
|
-
$:.unshift File.join(File.dirname(__FILE__),"..")
|
3
|
-
require 'ostruct'
|
4
|
-
require 'patir/configuration'
|
5
|
-
module Rutema
|
6
|
-
#This module defines the "configuration directives" used in the configuration of Rutema
|
7
|
-
#
|
8
|
-
#Example
|
9
|
-
#A configuration file needs as a minimum to define which parser to use and which tests to run.
|
10
|
-
#
|
11
|
-
#Since rutema configuration files are valid Ruby code, you can use the full power of the Ruby language including require directives
|
12
|
-
#
|
13
|
-
# require 'rake'
|
14
|
-
# configuration.parser={:class=>Rutema::MinimalXMLParser}
|
15
|
-
# configuration.tests=FileList['all/of/the/tests/**/*.*']
|
16
|
-
module RutemaConfiguration
|
17
|
-
#Adds a hash of values to the tools hash of the configuration
|
18
|
-
#
|
19
|
-
#This hash is then accessible in the parser and reporters as a property of the configuration instance
|
20
|
-
#
|
21
|
-
#Required keys:
|
22
|
-
# :name - the name to use for accessing the path in code
|
23
|
-
#Example:
|
24
|
-
# configuration.tool={:name=>"nunit",:path=>"/bin/nunit",:configuration=>{:important=>"info"}}
|
25
|
-
#
|
26
|
-
#The path to make can be accessed in the parser as
|
27
|
-
# @configuration.tools.nunit[:path]
|
28
|
-
#
|
29
|
-
#This way you can pass configuration information for the tools you use
|
30
|
-
def tool= definition
|
31
|
-
@tools||=Hash.new
|
32
|
-
raise Patir::ConfigurationException,"required key :name is missing from #{definition}" unless definition[:name]
|
33
|
-
@tools[definition[:name]]=definition
|
34
|
-
end
|
35
|
-
#Adds a path to the paths hash of the configuration
|
36
|
-
#
|
37
|
-
#Required keys:
|
38
|
-
# :name - the name to use for accessing the path in code
|
39
|
-
# :path - the path
|
40
|
-
#Example:
|
41
|
-
# configuration.path={:name=>"sources",:path=>"/src"}
|
42
|
-
def path= definition
|
43
|
-
@paths||=Hash.new
|
44
|
-
raise Patir::ConfigurationException,"required key :name is missing from #{definition}" unless definition[:name]
|
45
|
-
raise Patir::ConfigurationException,"required key :path is missing from #{definition}" unless definition[:path]
|
46
|
-
@paths[definition[:name]]=definition[:path]
|
47
|
-
end
|
48
|
-
|
49
|
-
#Path to the setup specification. (optional)
|
50
|
-
#
|
51
|
-
#The setup test runs before every test.
|
52
|
-
def setup= path
|
53
|
-
@setup=check_path(path)
|
54
|
-
end
|
55
|
-
|
56
|
-
#Path to the teardown specification. (optional)
|
57
|
-
#
|
58
|
-
#The teardown test runs after every test.
|
59
|
-
def teardown= path
|
60
|
-
@teardown=check_path(path)
|
61
|
-
end
|
62
|
-
|
63
|
-
#Path to the check specification. (optional)
|
64
|
-
#
|
65
|
-
#The check test runs once in the beginning before all the tests.
|
66
|
-
#
|
67
|
-
#If it fails no tests are run.
|
68
|
-
def check= path
|
69
|
-
@check=check_path(path)
|
70
|
-
end
|
71
|
-
|
72
|
-
#Hash values for passing data to the system. It's supposed to be used in the reporters and contain
|
73
|
-
#values such as version numbers, tester names etc.
|
74
|
-
def context= definition
|
75
|
-
@context||=Hash.new
|
76
|
-
raise Patir::ConfigurationException,"Only accepting hash values as context_data" unless definition.kind_of?(Hash)
|
77
|
-
definition.each do |k,v|
|
78
|
-
@context[k]=v
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
#Adds the specification identifiers available to this instance of Rutema
|
83
|
-
#
|
84
|
-
#These will usually be files, but they can be anything.
|
85
|
-
#Essentially this is an Array of strings that mean something to your parser
|
86
|
-
def tests= array_of_identifiers
|
87
|
-
@tests||=Array.new
|
88
|
-
@tests+=array_of_identifiers
|
89
|
-
end
|
90
|
-
|
91
|
-
#A hash defining the parser to use.
|
92
|
-
#
|
93
|
-
#The hash is passed as is to the parser constructor and each parser should define the necessary configuration keys.
|
94
|
-
#
|
95
|
-
#The only required key from the configurator's point fo view is :class which should be set to the fully qualified name of the class to use.
|
96
|
-
#
|
97
|
-
#Example:
|
98
|
-
# configuration.parser={:class=>Rutema::MinimalXMLParser}
|
99
|
-
def parser= definition
|
100
|
-
raise Patir::ConfigurationException,"required key :class is missing from #{definition}" unless definition[:class]
|
101
|
-
@parser=definition
|
102
|
-
end
|
103
|
-
|
104
|
-
#Adds a reporter to the configuration.
|
105
|
-
#
|
106
|
-
#As with the parser, the only required configuration key is :class and the definition hash is passed to the class' constructor.
|
107
|
-
#
|
108
|
-
#Unlike the parser, you can define multiple reporters.
|
109
|
-
def reporter= definition
|
110
|
-
@reporters||=Array.new
|
111
|
-
raise Patir::ConfigurationException,"required key :class is missing from #{definition}" unless definition[:class]
|
112
|
-
@reporters<<definition
|
113
|
-
end
|
114
|
-
|
115
|
-
private
|
116
|
-
#Checks if a path exists and raises a Patir::ConfigurationException if not
|
117
|
-
def check_path path
|
118
|
-
path=File.expand_path(path)
|
119
|
-
raise Patir::ConfigurationException,"#{path} does not exist" unless File.exists?(path)
|
120
|
-
return path
|
121
|
-
end
|
122
|
-
#Gives back a string of key=value,key=value for a hash
|
123
|
-
def definition_string definition
|
124
|
-
msg=Array.new
|
125
|
-
definition.each{|k,v| msg<<"#{k}=#{v}"}
|
126
|
-
return msg.join(",")
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
#This class reads a Rutema configuration file
|
131
|
-
#
|
132
|
-
#See Rutema::RutemaConfiguration for configuration examples and directives
|
133
|
-
class RutemaConfigurator<Patir::Configurator
|
134
|
-
include RutemaConfiguration
|
135
|
-
def initialize config_file,logger=nil
|
136
|
-
@reporters=Array.new
|
137
|
-
@context=Hash.new
|
138
|
-
@paths=Hash.new
|
139
|
-
@tools=Hash.new
|
140
|
-
@tests=Array.new
|
141
|
-
@setup=nil
|
142
|
-
@teardown=nil
|
143
|
-
@check=nil
|
144
|
-
super(config_file,logger)
|
145
|
-
end
|
146
|
-
|
147
|
-
def configuration
|
148
|
-
@configuration=OpenStruct.new
|
149
|
-
Dir.chdir(File.dirname(config_file)) do |path|
|
150
|
-
@configuration.tools=OpenStruct.new(@tools)
|
151
|
-
@configuration.paths=OpenStruct.new(@paths)
|
152
|
-
@configuration.setup=@setup
|
153
|
-
@configuration.teardown=@teardown
|
154
|
-
@configuration.check=@check
|
155
|
-
@configuration.context=@context
|
156
|
-
@configuration.parser=@parser
|
157
|
-
raise Patir::ConfigurationException,"No parser defined" unless @configuration.parser
|
158
|
-
raise Patir::ConfigurationException,"Syntax error in parser definition - missing :class" unless @configuration.parser[:class]
|
159
|
-
@configuration.reporters=@reporters
|
160
|
-
@configuration.tests=@tests.collect do |t|
|
161
|
-
if File.exists?(t)
|
162
|
-
File.expand_path(t)
|
163
|
-
else
|
164
|
-
t
|
165
|
-
end
|
166
|
-
end
|
167
|
-
@configuration.filename=@config_file
|
168
|
-
end
|
169
|
-
return @configuration
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
end
|