rutema 2.0.0.pre15 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00d7a4f19073abcdc37a290d8515fbecb4220c1d
4
- data.tar.gz: 6a4e2926eeca77c79578fca7113a84c6e9810885
3
+ metadata.gz: a5e0e4c18d2eab07c25f48a69bcdc1b107be341d
4
+ data.tar.gz: 2c7b678e57ff73713a0aa1dda240144650203351
5
5
  SHA512:
6
- metadata.gz: 0a69bcdb242e8feb2fef37f8fff62c1680c127a2d240f1cb034fe1306e605162c1fc97262795c3aa6d85cf925541bab1ee6bb8eed54f4eb55e2c300d6171395c
7
- data.tar.gz: 51f7a2cdb69bd39498bfefbe31820ff9a8b8d136bb2302b8be047e8af8aaaa62eea107daa8e11b357d57367b4f799a2e3f30380374ec863a74f88c2ea060158b
6
+ metadata.gz: 60f93501c1a3c659effff6f8c3eed6bd2f9e0b1384df14629c92b599d6c2ce57dede0491de2679ca7231a42a77e61269ed822e9531d69815a2ccdc4a6e02f87a
7
+ data.tar.gz: ec9a4ab8dd76ef4dcd606008d02cd9e00bd7786948b44a860ae45f4676c9128c2802418b3ea0566a7ea24c63d3d17cca33e8c18cdc874ad0ab06f5c5fb2f3624
@@ -1,3 +1,5 @@
1
+ == 2.0.0/ 2017-09-23
2
+ * Parsing behaviour has changed, parsing errors are not accepted and the run fails immediately
1
3
  == 2.0.0.pre15 /2017-02-08
2
4
  * Update gem dependencies
3
5
  == 2.0.0.pre14 /2017-01-11
@@ -27,7 +29,7 @@
27
29
  == 2.0.0.pre5 /2015-09-14
28
30
  * Add JUnit format reporter
29
31
  * The NUnit format is v3, which means it won't work for most CI plugins
30
- == 2.0.0 /2015-09-10
32
+ == 2.0.0.pre2 /2015-09-10
31
33
  * Completely rewritten execution engine
32
34
  * dropped Ruby 1.8.x, 1.9.x support, added 2.x
33
35
  * Rewritten configuration engine and new format for configuration files
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
- ##rutema
2
- [![Build Status](https://secure.travis-ci.org/damphyr/rutema.png)](http://travis-ci.org/damphyr/rutema) [![Coverage Status](https://coveralls.io/repos/damphyr/rutema/badge.svg)](https://coveralls.io/r/damphyr/rutema) [![Code Climate](https://codeclimate.com/github/damphyr/rutema.png)](https://codeclimate.com/github/damphyr/rutema)
1
+ ## rutema
2
+ [![Build Status](https://secure.travis-ci.org/damphyr/rutema.png)](http://travis-ci.org/damphyr/rutema) [![Coverage Status](https://coveralls.io/repos/damphyr/rutema/badge.svg)](https://coveralls.io/r/damphyr/rutema) [![Code Climate](https://codeclimate.com/github/damphyr/rutema.png)](https://codeclimate.com/github/damphyr/rutema) ![doc status](http://inch-ci.org/github/damphyr/rutema.svg?branch=master)
3
3
 
4
4
  rutema [http://github.com/damphyr/rutema](http://github.com/damphyr/rutema)
5
5
 
@@ -9,7 +9,8 @@ It enables the combination of different test tools while it takes care of loggin
9
9
 
10
10
  It's purpose is to make testing in heterogeneous environments easier.
11
11
 
12
- ###Why?
12
+ ### Why?
13
+
13
14
  Require consistency, repeatability and reliability from your test infrastructure while gathering data on every run.
14
15
 
15
16
  Whether running through a checklist of manual steps, or executing a sequence of fully automated commands we always want to know if a test has failed, where it failed and what was the state of the system at that time.
@@ -18,23 +19,33 @@ rutema will gather all logs, timestamp them, store them and report on them.
18
19
 
19
20
  Rutema core provides a reference implementation of a parser for a simple but extensible XML test specification format which works well out of the box but the framework provides clearly defined interfaces so you can write the parser for your own format and add reporters that log wherever is needed.
20
21
 
21
- ###The dry stuff
22
+ ### The dry stuff
23
+
22
24
  * Unified test execution environment for automated and manual tests
23
25
  * Extensible reports and notifications in various formats (email, rss, pdf, html etc.)
24
26
  * A well defined way to create a project specific test specification format
25
27
 
28
+ ### Further Reading
29
+
30
+ * [Configuring rutema](doc/CONFIGURATION.md)
31
+ * An [example](doc/EXAMPLE.md) of a (very simple) testing DSL with rutema
32
+ * High level [description](README.md) of the concepts behind rutema
33
+
26
34
  ## Installation:
35
+
27
36
  * gem install rutema
28
37
 
29
38
  ## Dependencies
39
+
30
40
  The core functionality of rutema depends on the following gems:
31
41
  * [patir](http://github.com/damphyr/patir)
32
42
  * [highline](http://highline.rubyforge.org/)
33
43
 
34
44
  ## License:
45
+
35
46
  (The MIT License)
36
47
 
37
- Copyright (c) 2007-2015 Vassilis Rizopoulos
48
+ Copyright (c) 2007-2017 Vassilis Rizopoulos
38
49
 
39
50
  Permission is hereby granted, free of charge, to any person obtaining
40
51
  a copy of this software and associated documentation files (the
@@ -53,4 +64,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
53
64
  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
54
65
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
55
66
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
56
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
67
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/bin/rutema CHANGED
@@ -1,4 +1,5 @@
1
- # Copyright (c) 2007-2015 Vassilis Rizopoulos. All rights reserved.
1
+ #!/usr/bin/env ruby
2
+ # Copyright (c) 2007-2017 Vassilis Rizopoulos. All rights reserved.
2
3
  require 'rutema/application'
3
4
  begin
4
5
  Rutema::App.new(ARGV)
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2015 Vassilis Rizopoulos. All rights reserved.
1
+ # Copyright (c) 2007-2017 Vassilis Rizopoulos. All rights reserved.
2
2
  require 'ostruct'
3
3
  require_relative 'parser'
4
4
  require_relative 'reporter'
@@ -47,21 +47,18 @@
47
47
  raise ConfigurationException,"required key :path is missing from #{definition}" unless definition[:path]
48
48
  @paths[definition[:name]]=definition[:path]
49
49
  end
50
-
51
50
  #Path to the setup specification. (optional)
52
51
  #
53
52
  #The setup test runs before every test.
54
53
  def setup= path
55
54
  @setup=check_path(path)
56
55
  end
57
-
58
56
  #Path to the teardown specification. (optional)
59
57
  #
60
58
  #The teardown test runs after every test.
61
59
  def teardown= path
62
60
  @teardown=check_path(path)
63
61
  end
64
-
65
62
  #Path to the suite setup specification. (optional)
66
63
  #
67
64
  #The suite setup test runs once in the beginning of a test run before all the tests.
@@ -75,14 +72,12 @@
75
72
 
76
73
  alias_method :check,:suite_setup
77
74
  alias_method :check=,:suite_setup=
78
-
79
75
  #Path to the suite teardown specification. (optional)
80
76
  #
81
77
  #The suite teardown test runs after all the tests.
82
78
  def suite_teardown= path
83
79
  @suite_teardown=check_path(path)
84
80
  end
85
-
86
81
  #Hash values for passing data to the system. It's supposed to be used in the reporters and contain
87
82
  #values such as version numbers, tester names etc.
88
83
  def context= definition
@@ -90,7 +85,6 @@
90
85
  raise ConfigurationException,"Only accepting hash values as context_data" unless definition.kind_of?(Hash)
91
86
  @context.merge!(definition)
92
87
  end
93
-
94
88
  #Adds the specification identifiers available to this instance of Rutema
95
89
  #
96
90
  #These will usually be files, but they can be anything.
@@ -98,7 +92,6 @@
98
92
  def tests= array_of_identifiers
99
93
  @tests+=array_of_identifiers.map{|f| full_path(f)}
100
94
  end
101
-
102
95
  #A hash defining the parser to use.
103
96
  #
104
97
  #The hash is passed as is to the parser constructor and each parser should define the necessary configuration keys.
@@ -111,7 +104,6 @@
111
104
  raise ConfigurationException,"required key :class is missing from #{definition}" unless definition[:class]
112
105
  @parser=definition
113
106
  end
114
-
115
107
  #A hash defining the runner to use.
116
108
  #
117
109
  #The hash is passed as is to the runner constructor and each runner should define the necessary configuration keys.
@@ -124,7 +116,6 @@
124
116
  raise ConfigurationException,"required key :class is missing from #{definition}" unless definition[:class]
125
117
  @runner=definition
126
118
  end
127
-
128
119
  #Adds a reporter to the configuration.
129
120
  #
130
121
  #As with the parser, the only required configuration key is :class and the definition hash is passed to the class' constructor.
@@ -134,7 +125,7 @@
134
125
  raise ConfigurationException,"required key :class is missing from #{definition}" unless definition[:class]
135
126
  @reporters[definition[:class]]=definition
136
127
  end
137
-
128
+ #:stopdoc
138
129
  def init
139
130
  @reporters={}
140
131
  @context={}
@@ -142,6 +133,7 @@
142
133
  @tools=OpenStruct.new
143
134
  @paths=OpenStruct.new
144
135
  end
136
+ #:startdoc
145
137
  private
146
138
  #Checks if a path exists and raises a ConfigurationException if not
147
139
  def check_path path
@@ -164,7 +156,9 @@
164
156
 
165
157
  class ConfigurationException<RuntimeError
166
158
  end
167
-
159
+ #The object we pass around after we load the configuration from file
160
+ #
161
+ #All relevant methods are in Rutema::ConfigurationDirectives
168
162
  class Configuration
169
163
  include ConfigurationDirectives
170
164
  attr_reader :filename
@@ -179,7 +173,6 @@
179
173
  yield self
180
174
  end
181
175
  end
182
-
183
176
  #Loads the configuration from a file
184
177
  #
185
178
  #Use this to chain configuration files together
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2015 Vassilis Rizopoulos. All rights reserved.
1
+ # Copyright (c) 2007-2017 Vassilis Rizopoulos. All rights reserved.
2
2
  require 'thread'
3
3
  require_relative 'parser'
4
4
  require_relative 'reporter'
@@ -6,6 +6,11 @@ require_relative 'runner'
6
6
  require_relative '../version'
7
7
 
8
8
  module Rutema
9
+ #Rutema::Engine implements the rutema workflow.
10
+ #
11
+ #It instantiates the configured parser, runner and reporter instances and wires them together via Rutema::Dispatcher
12
+ #
13
+ #The full workflow is Parse->Run->Report and corresponds to one call of the Engine#run method
9
14
  class Engine
10
15
  include Messaging
11
16
  def initialize configuration
@@ -24,18 +29,15 @@ module Rutema
24
29
  @dispatcher=Dispatcher.new(@queue,configuration)
25
30
  @configuration=configuration
26
31
  end
32
+ #Parse, run, report
27
33
  def run test_identifier=nil
28
34
  @dispatcher.run!
29
35
  #start
30
36
  message("start")
31
37
  suite_setup,suite_teardown,setup,teardown,tests=*parse(test_identifier)
32
- if tests.empty?
33
- if test_identifier && is_special?(test_identifier)
34
- run_scenarios([suite_setup],nil)
35
- else
36
- @dispatcher.exit
37
- raise RutemaError,"Did not parse any tests succesfully"
38
- end
38
+ if tests.empty?
39
+ @dispatcher.exit
40
+ raise RutemaError,"No tests to run!"
39
41
  else
40
42
  @runner.setup=setup
41
43
  @runner.teardown=teardown
@@ -47,14 +49,15 @@ module Rutema
47
49
  @dispatcher.exit
48
50
  @dispatcher.report(tests)
49
51
  end
52
+ #Parse a single test spec or all the specs listed in the configuration
50
53
  def parse test_identifier=nil
51
54
  specs=[]
52
55
  #so, while we are parsing, we have a list of tests
53
56
  #we're either parsing all of the tests, or just one
54
57
  #make sure the one test is on the list
55
58
  if test_identifier
56
- if is_spec_included?(test_identifier)
57
- specs<<parse_specification(File.expand_path(test_identifier)) unless is_special?(test_identifier)
59
+ if is_spec_included?(test_identifier)
60
+ specs<<parse_specification(File.expand_path(test_identifier))
58
61
  else
59
62
  error(File.expand_path(test_identifier),"does not exist in the configuration")
60
63
  end
@@ -67,15 +70,16 @@ module Rutema
67
70
  end
68
71
  private
69
72
  def parse_specifications tests
70
- tests.map{|t| parse_specification(t)}.compact
73
+ tests.map do |t|
74
+ parse_specification(t)
75
+ end.compact
71
76
  end
72
77
  def parse_specification spec_identifier
73
78
  begin
74
79
  @parser.parse_specification(spec_identifier)
75
80
  rescue Rutema::ParserError
76
81
  error(spec_identifier,$!.message)
77
- raise Rutema::ParserError, "In #{spec_identifier}: #{$!.message}" if is_special?(spec_identifier)
78
- nil
82
+ raise Rutema::ParserError, "In #{spec_identifier}: #{$!.message}"
79
83
  end
80
84
  end
81
85
  def parse_specials configuration
@@ -143,7 +147,13 @@ module Rutema
143
147
  full_path==@configuration.teardown
144
148
  end
145
149
  end
150
+ #The Rutema::Dispatcher functions as a demultiplexer between Rutema::Engine and the various reporters.
151
+ #
152
+ #In stream mode the incoming queue is popped periodically and the messages are destributed to the queues of any subscribed event reporters.
153
+ #
154
+ #By default this includes Rutema::Reporters::Collector which is then used at the end of a run to provide the collected data to all registered block mode reporters
146
155
  class Dispatcher
156
+ #The interval between queue operations
147
157
  INTERVAL=0.01
148
158
  def initialize queue,configuration
149
159
  @queue = queue
@@ -159,6 +169,7 @@ module Rutema
159
169
  @streaming_reporters<<@collector
160
170
  @configuration=configuration
161
171
  end
172
+ #Call this to establish a queue with the given identifier
162
173
  def subscribe identifier
163
174
  @queues[identifier]=Queue.new
164
175
  return @queues[identifier]
@@ -22,7 +22,7 @@ module Rutema
22
22
  return msg
23
23
  end
24
24
  end
25
-
25
+ #What it says on the tin.
26
26
  class ErrorMessage<Message
27
27
  def to_s
28
28
  msg="ERROR - "
@@ -31,7 +31,6 @@ module Rutema
31
31
  return msg
32
32
  end
33
33
  end
34
-
35
34
  #The Runner continuously sends these when executing tests
36
35
  #
37
36
  #If there is an engine error (e.g. when parsing) you will get an ErrorMessage, if it is a test error
@@ -62,7 +61,6 @@ module Rutema
62
61
  return msg.chomp
63
62
  end
64
63
  end
65
-
66
64
  #While executing tests the state of each test is collected in an
67
65
  #instance of ReportState and the collection is at the end passed to the available block reporters
68
66
  #
@@ -88,9 +86,11 @@ module Rutema
88
86
  end
89
87
 
90
88
  module Messaging
89
+ #Signal an error - use the test name/id as the identifier
91
90
  def error identifier,message
92
91
  @queue.push(ErrorMessage.new(:test=>identifier,:text=>message,:timestamp=>Time.now))
93
92
  end
93
+ #Informational message during test runs
94
94
  def message message
95
95
  case message
96
96
  when String
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2015 Vassilis Rizopoulos. All rights reserved.
1
+ # Copyright (c) 2007-2017 Vassilis Rizopoulos. All rights reserved.
2
2
  require 'patir/command'
3
3
 
4
4
  module Rutema
@@ -197,7 +197,6 @@ module Rutema
197
197
  return "#{@attributes[:step_type]}#{param}"
198
198
  end
199
199
  def to_s#:nodoc:
200
- param=""
201
200
  if self.has_cmd?
202
201
  msg="#{self.number} - #{self.cmd.to_s}"
203
202
  else
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2015 Vassilis Rizopoulos. All rights reserved.
1
+ # Copyright (c) 2007-2017 Vassilis Rizopoulos. All rights reserved.
2
2
  require_relative 'framework'
3
3
 
4
4
  module Rutema
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2015 Vassilis Rizopoulos. All rights reserved.
1
+ # Copyright (c) 2007-2017 Vassilis Rizopoulos. All rights reserved.
2
2
  module Rutema
3
3
  #Rutema supports two kinds of reporters.
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2015 Vassilis Rizopoulos. All rights reserved.
1
+ # Copyright (c) 2007-2017 Vassilis Rizopoulos. All rights reserved.
2
2
 
3
3
  require_relative "framework"
4
4
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2015 Vassilis Rizopoulos. All rights reserved.
1
+ # Copyright (c) 2007-2017 Vassilis Rizopoulos. All rights reserved.
2
2
  require 'highline'
3
3
  module Rutema
4
4
  #The Elements module provides the namespace for the various modules adding parser functionality
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2015 Vassilis Rizopoulos. All rights reserved.
1
+ # Copyright (c) 2007-2017 Vassilis Rizopoulos. All rights reserved.
2
2
  require 'rexml/document'
3
3
  require 'patir/command'
4
4
  require_relative '../core/parser'
@@ -3,7 +3,7 @@ module Rutema
3
3
  module Version
4
4
  MAJOR=2
5
5
  MINOR=0
6
- TINY="0.pre15"
6
+ TINY=0
7
7
  STRING=[ MAJOR, MINOR, TINY ].join( "." )
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rutema
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre15
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vassilis Rizopoulos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-09 00:00:00.000000000 Z
11
+ date: 2017-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: patir
@@ -71,8 +71,7 @@ description: "rutema [http://github.com/damphyr/rutema](http://github.com/damphy
71
71
  across different tools.\n\nIt enables the combination of different test tools while
72
72
  it takes care of logging, reporting, archiving of results and formalizes execution
73
73
  of automated and manual tests.\n\nIt's purpose is to make testing in heterogeneous
74
- environments easier. \n\n###Why?\nRequire consistency, repeatability and reliability
75
- from your test infrastructure while gathering data on every run."
74
+ environments easier. \n\n### Why?"
76
75
  email:
77
76
  - vassilisrizopoulos@gmail.com
78
77
  executables:
@@ -117,9 +116,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
116
  version: '0'
118
117
  required_rubygems_version: !ruby/object:Gem::Requirement
119
118
  requirements:
120
- - - ">"
119
+ - - ">="
121
120
  - !ruby/object:Gem::Version
122
- version: 1.3.1
121
+ version: '0'
123
122
  requirements: []
124
123
  rubyforge_project:
125
124
  rubygems_version: 2.5.2