rutema 0.9.1 → 0.9.2
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/History.txt +6 -1
- data/Manifest.txt +1 -0
- data/distro_test.sh +3 -1
- data/lib/rutema/reporters/activerecord.rb +1 -1
- data/lib/rutema/reporters/email.rb +8 -24
- data/lib/rutema/reporters/standard_reporters.rb +1 -0
- data/lib/rutema/reporters/text.rb +33 -0
- data/lib/rutema/system.rb +21 -5
- data/test/distro_test/config/full.rutema +3 -3
- data/test/distro_test/config/minimal.rutema +1 -1
- data/test/distro_test/specs/T005.spec +1 -1
- data/test/rutema.spec +1 -0
- data/test/test_reporter.rb +0 -1
- metadata +3 -2
data/History.txt
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
+
== 0.9.2 / 2008-09-10
|
2
|
+
* Fixed major blunder with test reporting
|
3
|
+
* Added text reporter for consistent text summaries
|
4
|
+
* More tests
|
5
|
+
* Fixed check test behaviour (was not running even when specified in the configuration)
|
6
|
+
* Fixed bungled emailing when using multiple addresses in the config
|
1
7
|
== 0.9.1 / 2008-09-09
|
2
8
|
* Modularisation of element parsing methods introduced.
|
3
9
|
* MinimalXMLParser refactored as example.
|
4
10
|
* Extra element parser modules available in the rutema_elements gem
|
5
11
|
* Cleaned up EmailReporter. Unit tests with Mocha, text report has a better layout
|
6
|
-
|
7
12
|
== 0.9.0 / 2008-09-08
|
8
13
|
* Ability to nest scenarios added to the base parser
|
9
14
|
* Documentation at http://patir.rubyforge.org/rutema/tool_configuration.html
|
data/Manifest.txt
CHANGED
data/distro_test.sh
CHANGED
@@ -2,4 +2,6 @@
|
|
2
2
|
rutemax -c test/distro_test/config/minimal.rutema
|
3
3
|
rutemax -c test/distro_test/config/database.rutema
|
4
4
|
rutemah -c test/distro_test/config/database.rutemah all
|
5
|
-
rutemax -c test/distro_test/config/
|
5
|
+
rutemax -c test/distro_test/config/full.rutema --check
|
6
|
+
rutemax -c test/distro_test/config/full.rutema
|
7
|
+
#rutemax -c test/distro_test/config/minimal.rutema --step
|
@@ -53,7 +53,7 @@ module Rutema
|
|
53
53
|
if spec
|
54
54
|
sc.version=spec.version if spec.has_version?
|
55
55
|
else
|
56
|
-
@logger.
|
56
|
+
@logger.debug("Could not find specification for #{scenario.sequence_name}")
|
57
57
|
end
|
58
58
|
if scenario.strategy==:attended
|
59
59
|
sc.attended=true
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# Copyright (c) 2007 Vassilis Rizopoulos. All rights reserved.
|
2
2
|
$:.unshift File.join(File.dirname(__FILE__),"..","..")
|
3
|
+
require 'net/smtp'
|
3
4
|
require 'rutema/reporter'
|
4
5
|
require 'rutema/specification'
|
6
|
+
require 'rutema/reporters/text'
|
5
7
|
require 'rutema/gems'
|
6
8
|
|
7
9
|
module Rutema
|
@@ -38,7 +40,6 @@ module Rutema
|
|
38
40
|
@mail.from = definition[:sender]
|
39
41
|
@mail.from||="rutema@#{@domain}"
|
40
42
|
@recipients=definition[:recipients]
|
41
|
-
@mail.to=@recipients
|
42
43
|
#customize
|
43
44
|
@subject=definition[:subject]
|
44
45
|
@subject||=""
|
@@ -52,42 +53,25 @@ module Rutema
|
|
52
53
|
|
53
54
|
def report specifications,runner_states,parse_errors,configuration
|
54
55
|
@mail.subject = "#{@subject}"
|
55
|
-
@mail.text =
|
56
|
+
@mail.text = TextReporter.new.report(specifications,runner_states,parse_errors,configuration)
|
56
57
|
begin
|
57
|
-
if @
|
58
|
+
if @recipients.empty?
|
58
59
|
@logger.error("No recipients for the report mail")
|
59
60
|
else
|
60
61
|
#
|
61
62
|
#~ if @password
|
62
63
|
#~ #if a password is defined, use cram_md5 authentication
|
63
64
|
#~ else
|
64
|
-
|
65
|
+
@logger.info("Emailing through #{@server}:#{@port}(#{@domain})")
|
66
|
+
Net::SMTP.start(@server, @port, @domain) {|smtp| smtp.send_message(@mail.to_s(),@mail.from,@recipients)}
|
65
67
|
#~ end
|
66
68
|
end#recipients empty
|
67
69
|
rescue
|
70
|
+
@logger.debug($!)
|
68
71
|
@logger.error("Sending of email report failed: #{$!}")
|
72
|
+
@logger.debug("Tried to sent to #{@recipients}")
|
69
73
|
end
|
70
74
|
@mail.to_s
|
71
75
|
end
|
72
|
-
private
|
73
|
-
def text_report runner_states,parse_errors
|
74
|
-
msg=""
|
75
|
-
#Report on parse errors
|
76
|
-
msg<<"No parse errors" if parse_errors.empty?
|
77
|
-
msg<<"One parse error:" if parse_errors.size==1
|
78
|
-
msg<<"#{parse_errors.size} parse errors:" if parse_errors.size>1
|
79
|
-
parse_errors.each do |er|
|
80
|
-
msg<<"\n\tin #{er[:filename]} : #{er[:error]}"
|
81
|
-
end
|
82
|
-
msg<<"\n---"
|
83
|
-
#Report on scenarios
|
84
|
-
msg<<"\nNo scenarios in this run" if runner_states.empty?
|
85
|
-
msg<<"\nOne scenario in the current run:" if runner_states.size==1
|
86
|
-
msg<<"\n#{runner_states.size} scenarios in the current run:" if runner_states.size>1
|
87
|
-
runner_states.each do |state|
|
88
|
-
msg<<"\n#{state.summary}\n---"
|
89
|
-
end
|
90
|
-
return msg
|
91
|
-
end
|
92
76
|
end
|
93
77
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Rutema
|
2
|
+
#This reporter cerates a simple text summary of a test run
|
3
|
+
class TextReporter
|
4
|
+
def initialize params=nil
|
5
|
+
end
|
6
|
+
|
7
|
+
#Returns the text summary
|
8
|
+
def report specifications,runner_states,parse_errors,configuration
|
9
|
+
return text_report(specifications,runner_states,parse_errors)
|
10
|
+
end
|
11
|
+
private
|
12
|
+
def text_report specifications,runner_states,parse_errors
|
13
|
+
msg=""
|
14
|
+
#Report on parse errors
|
15
|
+
msg<<"No parse errors" if parse_errors.empty?
|
16
|
+
msg<<"One parse error:" if parse_errors.size==1
|
17
|
+
msg<<"#{parse_errors.size} parse errors:" if parse_errors.size>1
|
18
|
+
parse_errors.each do |er|
|
19
|
+
msg<<"\n\tin #{er[:filename]} : #{er[:error]}"
|
20
|
+
end
|
21
|
+
msg<<"\n---"
|
22
|
+
#Report on scenarios
|
23
|
+
msg<<"\nNo scenarios in this run" if runner_states.empty?
|
24
|
+
msg<<"\nOne scenario in the current run:" if runner_states.size==1
|
25
|
+
msg<<"\n#{runner_states.size} scenarios in the current run:" if runner_states.size>1
|
26
|
+
runner_states.each do |state|
|
27
|
+
msg<<"\n#{state.summary}\n---"
|
28
|
+
end
|
29
|
+
return msg
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/lib/rutema/system.rb
CHANGED
@@ -11,7 +11,7 @@ module Rutema
|
|
11
11
|
module Version
|
12
12
|
MAJOR=0
|
13
13
|
MINOR=9
|
14
|
-
TINY=
|
14
|
+
TINY=2
|
15
15
|
STRING=[ MAJOR, MINOR, TINY ].join( "." )
|
16
16
|
end
|
17
17
|
#The Elements module provides the namespace for the various modules adding parser functionality
|
@@ -269,15 +269,15 @@ module Rutema
|
|
269
269
|
@reporters=@configuration.reporters.collect{ |reporter| instantiate_class(reporter) }
|
270
270
|
@reporters.compact!
|
271
271
|
@configuration.tests.collect!{|t| File.expand_path(t)}
|
272
|
-
@runner=create_runner
|
273
|
-
@parsed_files=Array.new
|
274
272
|
#this will hold any specifications that are succesfully parsed.
|
275
273
|
@specifications=Hash.new
|
274
|
+
@parsed_files=Array.new
|
276
275
|
end
|
277
276
|
#Runs a set of tests
|
278
277
|
#
|
279
278
|
#mode can be :all, :attended, :unattended or a test filename
|
280
279
|
def run mode
|
280
|
+
@runner||=create_runner
|
281
281
|
@configuration.context.start_time=Time.now
|
282
282
|
@logger.info("Run started in mode '#{mode}'")
|
283
283
|
begin
|
@@ -336,7 +336,7 @@ module Rutema
|
|
336
336
|
return @runner.success?
|
337
337
|
end
|
338
338
|
def to_s
|
339
|
-
"Parsed #{@parsed_files.size} files\n#{
|
339
|
+
"Parsed #{@parsed_files.size} files\n#{TextReporter.new.report(@specifications,@runner.states.values,@parse_errors,@configuration)}"
|
340
340
|
end
|
341
341
|
private
|
342
342
|
def instantiate_class definition
|
@@ -405,9 +405,25 @@ module Rutema
|
|
405
405
|
if specs.empty?
|
406
406
|
@logger.error("No tests to run")
|
407
407
|
else
|
408
|
-
|
408
|
+
if @configuration.check
|
409
|
+
@logger.info("Parsing check test '#{@configuration.check}'")
|
410
|
+
spec=parse_specification(@configuration.check)
|
411
|
+
if spec
|
412
|
+
@logger.info("Running check test '#{spec}'")
|
413
|
+
if run_test(spec).success?
|
414
|
+
specs.each{|s| run_test(s)}
|
415
|
+
else
|
416
|
+
@logger.error("Check test failed")
|
417
|
+
end
|
418
|
+
else
|
419
|
+
@logger.error("Error parsing check test")
|
420
|
+
end
|
421
|
+
else
|
422
|
+
specs.each{|s| run_test(s)}
|
423
|
+
end
|
409
424
|
end
|
410
425
|
end
|
426
|
+
|
411
427
|
def run_test specification
|
412
428
|
@logger.info("Running #{specification.name} - #{specification.title}")
|
413
429
|
if specification.scenario
|
@@ -10,6 +10,6 @@ configuration.tests=[
|
|
10
10
|
configuration.tool={:name=>"test",:path=>".",:configuration=>{:key=>"value"}}
|
11
11
|
configuration.path={:name=>"test",:path=>"."}
|
12
12
|
configuration.context={:key=>"value"}
|
13
|
-
configuration.check="."
|
14
|
-
configuration.teardown="."
|
15
|
-
configuration.setup="."
|
13
|
+
configuration.check="../specs/check.spec"
|
14
|
+
configuration.teardown="../specs/teardown.spec"
|
15
|
+
configuration.setup="../specs/setup.spec"
|
data/test/rutema.spec
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
<command cmd="rutemax -c distro_test/config/minimal.rutema"/>
|
6
6
|
<command cmd="rutemax -c distro_test/config/database.rutema"/>
|
7
7
|
<command cmd="rutemax -c distro_test/config/database.rutema distro_test/specs/T001.spec"/>
|
8
|
+
<command cmd="rutemax -c distro_test/config/full.rutema"/>
|
8
9
|
<command cmd="rutemah -c distro_test/config/database.rutemah all"/>
|
9
10
|
</scenario>
|
10
11
|
</specification>
|
data/test/test_reporter.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rutema
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vassilis Rizopoulos
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09-
|
12
|
+
date: 2008-09-10 00:00:00 +02:00
|
13
13
|
default_executable: rutemax
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/rutema/reporters/activerecord.rb
|
113
113
|
- lib/rutema/reporters/email.rb
|
114
114
|
- lib/rutema/reporters/standard_reporters.rb
|
115
|
+
- lib/rutema/reporters/text.rb
|
115
116
|
- lib/rutema/specification.rb
|
116
117
|
- lib/rutema/system.rb
|
117
118
|
- selftest.sh
|