rutema 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/README.txt +1 -1
- data/Rakefile +5 -4
- data/bin/rutema_upgrader +0 -1
- data/bin/rutemax +2 -7
- data/distro_test.sh +4 -4
- data/lib/rutema/gems.rb +3 -11
- data/lib/rutema/model.rb +2 -1
- data/lib/rutema/reporter.rb +0 -1
- data/lib/rutema/reporters/activerecord.rb +0 -1
- data/lib/rutema/reporters/email.rb +3 -1
- data/lib/rutema/reporters/text.rb +27 -8
- data/lib/rutema/specification.rb +0 -1
- data/lib/rutema/system.rb +30 -21
- data/selftest.sh +1 -1
- data/test/test_reporter.rb +0 -0
- metadata +36 -9
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 1.0.5 / 2009-07-16
|
2
|
+
* Updated gem dependencies to use activerecord 2.3.2
|
3
|
+
* A failure of the check test now passes all test stati (as not_executed). This will not skew statistics that show the trends on test numbers
|
4
|
+
* Setup and teardown are no longer executed for check tests
|
5
|
+
* fixed bug in element_prompt where a negative answer would not set an error
|
6
|
+
* TextReporter now shows the failed tests first, followed by tests with warnings, not executed tests and finally the successes. This gives a better overview of the important bits
|
7
|
+
* removed require "rubygems" from library code
|
1
8
|
== 1.0.4 / 2008-11-7
|
2
9
|
* Added functionality that allows ignoring the result of a step. The step is considered always successful
|
3
10
|
== 1.0.3 / 2008-10-28
|
data/README.txt
CHANGED
@@ -32,7 +32,7 @@ See http://patir.rubyforge.org/rutema/distro_test.html for an introductory examp
|
|
32
32
|
== LICENSE:
|
33
33
|
(The Ruby License)
|
34
34
|
|
35
|
-
rutema is copyright (c) 2007 Vassilis Rizopoulos
|
35
|
+
rutema is copyright (c) 2007 - 2009 Vassilis Rizopoulos
|
36
36
|
|
37
37
|
You can redistribute it and/or modify it under either the terms of the GPL
|
38
38
|
(see COPYING.txt file), or the conditions below:
|
data/Rakefile
CHANGED
@@ -6,7 +6,8 @@ require 'rubygems'
|
|
6
6
|
require 'hoe'
|
7
7
|
require 'rutema/system'
|
8
8
|
|
9
|
-
Hoe.
|
9
|
+
Hoe.spec('rutema') do |p|
|
10
|
+
p.version=Rutema::Version::STRING
|
10
11
|
p.rubyforge_name = 'patir'
|
11
12
|
p.author = "Vassilis Rizopoulos"
|
12
13
|
p.email = "riva@braveworld.net"
|
@@ -17,9 +18,9 @@ Hoe.new('rutema', "#{Rutema::Version::STRING}") do |p|
|
|
17
18
|
p.extra_deps<<['patir',">=0.6.0"]
|
18
19
|
p.extra_deps<<['highline']
|
19
20
|
p.extra_deps<<['mailfactory']
|
20
|
-
p.extra_deps<<['activerecord','=2.
|
21
|
-
p.extra_deps<<['ruport','
|
22
|
-
p.extra_deps<<['acts_as_reportable','
|
21
|
+
p.extra_deps<<['activerecord','=2.3.2']
|
22
|
+
p.extra_deps<<['ruport','=1.6.1']
|
23
|
+
p.extra_deps<<['acts_as_reportable','=1.1.1']
|
23
24
|
p.spec_extras={:executables=>["rutemax","rutema_upgrader"],
|
24
25
|
:default_executable=>"rutemax"}
|
25
26
|
end
|
data/bin/rutema_upgrader
CHANGED
data/bin/rutemax
CHANGED
data/distro_test.sh
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/bin/sh
|
2
|
-
rutemax -c test/distro_test/config/minimal.rutema
|
3
|
-
rutemax -c test/distro_test/config/database.rutema
|
4
|
-
rutemax -c test/distro_test/config/full.rutema --check
|
5
|
-
rutemax -c test/distro_test/config/full.rutema
|
2
|
+
ruby -rubygems -I lib/ bin/rutemax -c test/distro_test/config/minimal.rutema
|
3
|
+
ruby -rubygems -I lib/ bin/rutemax -c test/distro_test/config/database.rutema
|
4
|
+
ruby -rubygems -I lib/ bin/rutemax -c test/distro_test/config/full.rutema --check
|
5
|
+
ruby -rubygems -I lib/ bin/rutemax -c test/distro_test/config/full.rutema
|
6
6
|
#rutemax -c test/distro_test/config/minimal.rutema --step
|
data/lib/rutema/gems.rb
CHANGED
@@ -1,11 +1,3 @@
|
|
1
|
-
|
2
|
-
gem '
|
3
|
-
|
4
|
-
gem 'patir','>=0.5.8'
|
5
|
-
require 'patir/configuration'
|
6
|
-
require 'patir/command'
|
7
|
-
require 'patir/base'
|
8
|
-
|
9
|
-
require 'ruport/acts_as_reportable'
|
10
|
-
require 'mailfactory'
|
11
|
-
require 'highline'
|
1
|
+
gem 'activerecord','=2.3.2'
|
2
|
+
gem 'patir',">=0.6.1"
|
3
|
+
gem 'acts_as_reportable','=1.1.1'
|
data/lib/rutema/model.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Copyright (c) 2007 Vassilis Rizopoulos. All rights reserved.
|
2
2
|
$:.unshift File.join(File.dirname(__FILE__),"..")
|
3
|
-
require '
|
3
|
+
require 'active_record'
|
4
|
+
require 'ruport/acts_as_reportable'
|
4
5
|
#this fixes the AR Logger hack that annoys me sooooo much
|
5
6
|
class Logger
|
6
7
|
private
|
data/lib/rutema/reporter.rb
CHANGED
@@ -4,7 +4,7 @@ require 'net/smtp'
|
|
4
4
|
require 'rutema/reporter'
|
5
5
|
require 'rutema/specification'
|
6
6
|
require 'rutema/reporters/text'
|
7
|
-
require '
|
7
|
+
require 'mailfactory'
|
8
8
|
|
9
9
|
module Rutema
|
10
10
|
#The following configuration keys are used by EmailReporter:
|
@@ -13,6 +13,8 @@ module Rutema
|
|
13
13
|
#
|
14
14
|
#:port - the port to use (defaults to 25)
|
15
15
|
#
|
16
|
+
#:domain - the domain the mail is coming from
|
17
|
+
#
|
16
18
|
#:sender - the sender of the email (defaults to rutema@domain)
|
17
19
|
#
|
18
20
|
#:recipients - an array of strings with the recipients of the report emails
|
@@ -25,17 +25,36 @@ module Rutema
|
|
25
25
|
msg<<"\n---"
|
26
26
|
#Report on scenarios
|
27
27
|
msg<<"\nNo scenarios in this run" if runner_states.empty?
|
28
|
-
msg<<"\nOne scenario in the current run
|
29
|
-
msg<<"\n#{runner_states.size} scenarios in the current run
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
msg<<"\nOne scenario in the current run" if runner_states.size==1
|
29
|
+
msg<<"\n#{runner_states.size} scenarios in the current run" if runner_states.size>1
|
30
|
+
not_run = runner_states.select{|state| state.status == :not_executed }.sort_by {|state| state.sequence_id.to_i}
|
31
|
+
errors = runner_states.select{|state| state.status == :error }.sort_by {|state| state.sequence_id.to_i}
|
32
|
+
warnings = runner_states.select{|state| state.status == :warning }.sort_by {|state| state.sequence_id.to_i}
|
33
|
+
successes = runner_states.select{|state| state.status == :success }.sort_by {|state| state.sequence_id.to_i}
|
34
|
+
msg<<"\n#{errors.size} errors, #{warnings.size} warnings, #{successes.size} successes"
|
35
|
+
msg<<"\nErrors:" unless errors.empty?
|
36
|
+
msg<<scenario_summaries(errors,specifications)
|
37
|
+
msg<<"\nWarnings:" unless warnings.empty?
|
38
|
+
msg<<scenario_summaries(warnings,specifications)
|
39
|
+
msg<<"\nNot executed:" unless not_run.empty?
|
40
|
+
not_run.each do |state|
|
34
41
|
msg<<"\n#{specifications[state.sequence_name].title}" if specifications[state.sequence_name]
|
35
|
-
|
42
|
+
end
|
43
|
+
msg<<"\nSuccesses:" unless successes.empty?
|
44
|
+
msg<<scenario_summaries(successes,specifications)
|
45
|
+
|
46
|
+
return msg
|
47
|
+
end
|
48
|
+
|
49
|
+
def scenario_summaries scenarios,specifications
|
50
|
+
msg=""
|
51
|
+
unless scenarios.empty?
|
52
|
+
scenarios.each do |state|
|
53
|
+
msg<<"\n#{specifications[state.sequence_name].title}" if specifications[state.sequence_name]
|
54
|
+
msg<<"\n#{state.summary}\n---"
|
55
|
+
end
|
36
56
|
end
|
37
57
|
return msg
|
38
58
|
end
|
39
59
|
end
|
40
|
-
|
41
60
|
end
|
data/lib/rutema/specification.rb
CHANGED
data/lib/rutema/system.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
# Copyright (c) 2007 Vassilis Rizopoulos. All rights reserved.
|
2
2
|
$:.unshift File.join(File.dirname(__FILE__),"..")
|
3
3
|
require 'rexml/document'
|
4
|
+
require 'patir/configuration'
|
5
|
+
require 'patir/command'
|
6
|
+
require 'patir/base'
|
4
7
|
require 'rutema/specification'
|
5
8
|
require 'rutema/configuration'
|
6
9
|
require 'rutema/reporters/standard_reporters'
|
7
|
-
require 'rutema/gems'
|
8
10
|
|
9
11
|
module Rutema
|
10
12
|
#This module defines the version numbers for the library
|
11
13
|
module Version
|
12
14
|
MAJOR=1
|
13
15
|
MINOR=0
|
14
|
-
TINY=
|
16
|
+
TINY=5
|
15
17
|
STRING=[ MAJOR, MINOR, TINY ].join( "." )
|
16
18
|
end
|
17
19
|
#The Elements module provides the namespace for the various modules adding parser functionality
|
@@ -29,8 +31,10 @@ module Rutema
|
|
29
31
|
def element_echo step
|
30
32
|
step.cmd=Patir::RubyCommand.new("echo"){|cmd| cmd.error="";cmd.output="#{step.text}";$stdout.puts(cmd.output) ;:success}
|
31
33
|
end
|
32
|
-
#
|
33
|
-
# <
|
34
|
+
#prompt asks the user a yes/no question. Answering yes means the step is succesful.
|
35
|
+
# <prompt text="Do you want fries with that?"/>
|
36
|
+
#
|
37
|
+
#A prompt element automatically makes a specification "attended"
|
34
38
|
def element_prompt step
|
35
39
|
step.attended=true
|
36
40
|
step.cmd=Patir::RubyCommand.new("prompt") do |cmd|
|
@@ -38,17 +42,13 @@ module Rutema
|
|
38
42
|
cmd.error=""
|
39
43
|
if HighLine.new.agree("#{step.text}")
|
40
44
|
step.output="y"
|
41
|
-
:success
|
42
45
|
else
|
43
|
-
|
44
|
-
:error
|
46
|
+
raise "n"
|
45
47
|
end#if
|
46
48
|
end#do rubycommand
|
47
49
|
end
|
48
|
-
#
|
49
|
-
# <
|
50
|
-
#
|
51
|
-
#A prompt element automatically makes a specification "attended"
|
50
|
+
#command executes a shell command
|
51
|
+
# <command cmd="useful_command.exe with parameters", working_directory="some/directory"/>
|
52
52
|
def element_command step
|
53
53
|
raise ParserError,"missing required attribute cmd in #{step}" unless step.has_cmd?
|
54
54
|
wd=Dir.pwd
|
@@ -264,6 +264,7 @@ module Rutema
|
|
264
264
|
#This class coordinates parsing, execution and reporting of test specifications
|
265
265
|
class Coordinator
|
266
266
|
attr_accessor :configuration,:parse_errors,:parsed_files
|
267
|
+
attr_reader :test_states
|
267
268
|
def initialize configuration,logger=nil
|
268
269
|
@logger=logger
|
269
270
|
@logger||=Patir.setup_logger
|
@@ -277,6 +278,7 @@ module Rutema
|
|
277
278
|
#this will hold any specifications that are succesfully parsed.
|
278
279
|
@specifications=Hash.new
|
279
280
|
@parsed_files=Array.new
|
281
|
+
@test_states=Hash.new
|
280
282
|
end
|
281
283
|
#Runs a set of tests
|
282
284
|
#
|
@@ -323,7 +325,7 @@ module Rutema
|
|
323
325
|
def parse_all_specifications
|
324
326
|
@configuration.tests.collect do |t|
|
325
327
|
begin
|
326
|
-
parse_specification(t)
|
328
|
+
spec=parse_specification(t)
|
327
329
|
rescue
|
328
330
|
@logger.debug($!)
|
329
331
|
@logger.error($!.message)
|
@@ -334,10 +336,14 @@ module Rutema
|
|
334
336
|
#
|
335
337
|
#It then joins the threads and returns when all of them are finished.
|
336
338
|
def report
|
339
|
+
#get the states from the runner
|
340
|
+
@runner.states.each do |k,v|
|
341
|
+
@test_states[k]=v
|
342
|
+
end
|
337
343
|
threads=Array.new
|
338
344
|
#get the runner stati and the configuration and give it to the reporters
|
339
345
|
@reporters.each do |reporter|
|
340
|
-
threads<<Thread.new(reporter,@specifications,@
|
346
|
+
threads<<Thread.new(reporter,@specifications,@test_states.values,@parse_errors,@configuration) do |reporter,specs,status,perrors,configuration|
|
341
347
|
@logger.debug(reporter.report(specs,status,perrors,configuration))
|
342
348
|
end
|
343
349
|
end
|
@@ -397,8 +403,10 @@ module Rutema
|
|
397
403
|
msg="Duplicate specification name '#{spec.name}' in '#{spec_file}'"
|
398
404
|
@logger.error(msg)
|
399
405
|
@parse_errors<<{:filename=>spec_file,:error=>msg}
|
406
|
+
@test_states[spec.name]=Patir::CommandSequenceStatus.new(spec.name,[])
|
400
407
|
else
|
401
408
|
@specifications[spec.name]=spec
|
409
|
+
@test_states[spec.name]=Patir::CommandSequenceStatus.new(spec.name,spec.scenario.steps)
|
402
410
|
end
|
403
411
|
rescue ParserError
|
404
412
|
@logger.error("Error parsing '#{spec_file}': #{$!.message}")
|
@@ -422,7 +430,7 @@ module Rutema
|
|
422
430
|
spec=parse_specification(@configuration.check)
|
423
431
|
if spec
|
424
432
|
@logger.info("Running check test '#{spec}'")
|
425
|
-
if run_test(spec).success?
|
433
|
+
if run_test(spec,false).success?
|
426
434
|
specs.each{|s| run_test(s)}
|
427
435
|
else
|
428
436
|
@logger.error("Check test failed")
|
@@ -436,14 +444,15 @@ module Rutema
|
|
436
444
|
end
|
437
445
|
end
|
438
446
|
|
439
|
-
def run_test specification
|
447
|
+
def run_test specification,run_setup=true
|
440
448
|
@logger.info("Running #{specification.name} - #{specification.title}")
|
441
449
|
if specification.scenario
|
442
|
-
status=@runner.run(specification.name,specification.scenario)
|
450
|
+
status=@runner.run(specification.name,specification.scenario,run_setup)
|
443
451
|
else
|
444
452
|
@logger.warn("#{specification.name} has no scenario")
|
445
453
|
status=:not_executed
|
446
454
|
end
|
455
|
+
@test_states[specification.name]=status
|
447
456
|
return status
|
448
457
|
end
|
449
458
|
end
|
@@ -472,10 +481,10 @@ module Rutema
|
|
472
481
|
#Runs a scenario and stores the result internally
|
473
482
|
#
|
474
483
|
#Returns the result of the run as a Patir::CommandSequenceStatus
|
475
|
-
def run name,scenario
|
484
|
+
def run name,scenario, run_setup=true
|
476
485
|
@logger.debug("Starting run for #{name} with #{scenario.inspect}")
|
477
486
|
#if setup /teardown is defined we need to execute them before and after
|
478
|
-
if @setup
|
487
|
+
if @setup && run_setup
|
479
488
|
@logger.info("Setup for #{name}")
|
480
489
|
@states["#{name}_setup"]=run_scenario("#{name}_setup",@setup)
|
481
490
|
@states["#{name}_setup"].sequence_id="s#{@number_of_runs}"
|
@@ -492,7 +501,8 @@ module Rutema
|
|
492
501
|
@states[name]=run_scenario(name,scenario)
|
493
502
|
@states[name].sequence_id="#{@number_of_runs}"
|
494
503
|
end
|
495
|
-
|
504
|
+
#no setup means no teardown
|
505
|
+
if @teardown && run_setup
|
496
506
|
#always execute teardown
|
497
507
|
@logger.warn("Teardown for #{name}")
|
498
508
|
@states["#{name}_teardown"]=run_scenario("#{name}_teardown",@teardown)
|
@@ -501,7 +511,7 @@ module Rutema
|
|
501
511
|
@number_of_runs+=1
|
502
512
|
return @states[name]
|
503
513
|
end
|
504
|
-
|
514
|
+
|
505
515
|
#Returns the state of the scenario with the given name.
|
506
516
|
#
|
507
517
|
#Will return nil if no scenario is found under that name.
|
@@ -575,7 +585,6 @@ module Rutema
|
|
575
585
|
@logger.warn("Step failed but result is being ignored!")
|
576
586
|
@logger.warn(msg)
|
577
587
|
step.status=:success
|
578
|
-
|
579
588
|
else
|
580
589
|
@logger.error(msg)
|
581
590
|
end
|
data/selftest.sh
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
#!/bin/sh
|
2
|
-
rutemax -c test/rutema.rutema all
|
2
|
+
ruby -rubygems -I lib/ bin/rutemax -c test/rutema.rutema all
|
data/test/test_reporter.rb
CHANGED
Binary file
|
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: 1.0.
|
4
|
+
version: 1.0.5
|
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:
|
12
|
+
date: 2009-07-16 00:00:00 +02:00
|
13
13
|
default_executable: rutemax
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 2.
|
53
|
+
version: 2.3.2
|
54
54
|
version:
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: ruport
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
version_requirement:
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- - "
|
61
|
+
- - "="
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: 1.6.1
|
64
64
|
version:
|
@@ -68,7 +68,7 @@ dependencies:
|
|
68
68
|
version_requirement:
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- - "
|
71
|
+
- - "="
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: 1.1.1
|
74
74
|
version:
|
@@ -80,9 +80,34 @@ dependencies:
|
|
80
80
|
requirements:
|
81
81
|
- - ">="
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: 2.3.2
|
84
84
|
version:
|
85
|
-
description:
|
85
|
+
description: |-
|
86
|
+
== DESCRIPTION:
|
87
|
+
rutema is a test execution tool with a twist.
|
88
|
+
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.
|
89
|
+
It's purpose is to make testing in heterogeneous environments easier.
|
90
|
+
|
91
|
+
For more information look at http://patir.rubyforge.org/rutema
|
92
|
+
|
93
|
+
== FEATURES/PROBLEMS:
|
94
|
+
* Unified test execution environment for automated and manual tests
|
95
|
+
* Extensible reports and notifications in various formats (email, rss, pdf, html etc.)
|
96
|
+
* Web frontend and command line report generation tools for browsing the test results database (with rutemaweb)
|
97
|
+
* Comprehensive history of test execution
|
98
|
+
* A well defined way to create a project specific test specification format
|
99
|
+
|
100
|
+
== SYNOPSIS:
|
101
|
+
See http://patir.rubyforge.org/rutema/distro_test.html for an introductory example.
|
102
|
+
|
103
|
+
== REQUIREMENTS:
|
104
|
+
* patir (http://patir.rubyforge.org)
|
105
|
+
* mailfactory (http://rubyforge.org/projects/mailfactory/)
|
106
|
+
* activerecord (http://ar.rubyonrails.com/)
|
107
|
+
* sqlite3 (http://rubyforge.org/projects/sqlite-ruby/)
|
108
|
+
* ruport (http://rubyreports.org/)
|
109
|
+
* acts_as_reportable
|
110
|
+
* highline
|
86
111
|
email: riva@braveworld.net
|
87
112
|
executables:
|
88
113
|
- rutemax
|
@@ -139,6 +164,8 @@ files:
|
|
139
164
|
- test/test_system.rb
|
140
165
|
has_rdoc: true
|
141
166
|
homepage:
|
167
|
+
licenses: []
|
168
|
+
|
142
169
|
post_install_message:
|
143
170
|
rdoc_options:
|
144
171
|
- --main
|
@@ -160,9 +187,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
160
187
|
requirements: []
|
161
188
|
|
162
189
|
rubyforge_project: patir
|
163
|
-
rubygems_version: 1.3.
|
190
|
+
rubygems_version: 1.3.4
|
164
191
|
signing_key:
|
165
|
-
specification_version:
|
192
|
+
specification_version: 3
|
166
193
|
summary: rutema is a test execution and management framework for heterogeneous testing environments
|
167
194
|
test_files:
|
168
195
|
- test/test_configuration.rb
|