rutema 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.0.6 / 2009-09-4
2
+ * The run context is now passed to the runner and subsequently to the TestStep#run method
3
+ This way you can pass informaton to the command being run (context contains information on the start time of the run, the spec filename as well as any information added in the configuration)
4
+ * Minor bugfix in the activerecord reporter to avoid crashes due to nil runner states
5
+ * The runner adds the current scenario name to the context passed
1
6
  == 1.0.5 / 2009-07-16
2
7
  * Updated gem dependencies to use activerecord 2.3.2
3
8
  * 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
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ Hoe.spec('rutema') do |p|
15
15
  p.description = p.paragraphs_of('README.txt', 1..5).join("\n\n")
16
16
  p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
17
17
  p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
18
- p.extra_deps<<['patir',">=0.6.0"]
18
+ p.extra_deps<<['patir',">=0.6.4"]
19
19
  p.extra_deps<<['highline']
20
20
  p.extra_deps<<['mailfactory']
21
21
  p.extra_deps<<['activerecord','=2.3.2']
@@ -1,6 +1,5 @@
1
1
  # Copyright (c) 2007 Vassilis Rizopoulos. All rights reserved.
2
2
  $:.unshift File.join(File.dirname(__FILE__),"..")
3
- require 'rutema/gems'
4
3
 
5
4
  module Rutema
6
5
  #This module defines the "configuration directives" used in the configuration of RutemaX
data/lib/rutema/db.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # Copyright (c) 2008 Vassilis Rizopoulos, Markus Barchfeld. All rights reserved.
2
2
  $:.unshift File.join(File.dirname(__FILE__),"..")
3
- require 'rutema/gems'
4
3
 
5
4
  module Rutema
6
5
 
data/lib/rutema/gems.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  gem 'activerecord','=2.3.2'
2
- gem 'patir',">=0.6.1"
2
+ gem 'patir',">=0.6.4"
3
3
  gem 'acts_as_reportable','=1.1.1'
@@ -41,6 +41,7 @@ module Rutema
41
41
  er.error=pe[:error]
42
42
  run_entry.parse_errors<<er
43
43
  end
44
+ runner_states.compact!
44
45
  runner_states.each do |scenario|
45
46
  sc=Model::Scenario.new
46
47
  sc.name=scenario.sequence_name
@@ -194,9 +194,9 @@ module Rutema
194
194
  def status= st
195
195
  @attributes[:cmd].status=st if @attributes[:cmd]
196
196
  end
197
- def run
197
+ def run context=nil
198
198
  return not_executed unless @attributes[:cmd]
199
- return @attributes[:cmd].run
199
+ return @attributes[:cmd].run(context)
200
200
  end
201
201
  def reset
202
202
  @attributes[:cmd].reset if @attributes[:cmd]
data/lib/rutema/system.rb CHANGED
@@ -13,7 +13,7 @@ module Rutema
13
13
  module Version
14
14
  MAJOR=1
15
15
  MINOR=0
16
- TINY=5
16
+ TINY=6
17
17
  STRING=[ MAJOR, MINOR, TINY ].join( "." )
18
18
  end
19
19
  #The Elements module provides the namespace for the various modules adding parser functionality
@@ -386,9 +386,9 @@ module Rutema
386
386
  end
387
387
  if @configuration.use_step_by_step
388
388
  @logger.info("Using StepRunner")
389
- return StepRunner.new(setup,teardown,@logger)
389
+ return StepRunner.new(@configuration.context,setup,teardown,@logger)
390
390
  else
391
- return Runner.new(setup,teardown,@logger)
391
+ return Runner.new(@configuration.context,setup,teardown,@logger)
392
392
  end
393
393
  end
394
394
 
@@ -459,13 +459,13 @@ module Rutema
459
459
 
460
460
  #Runner executes TestScenario instances and maintains the state of all scenarios run.
461
461
  class Runner
462
- attr_reader :states,:number_of_runs
462
+ attr_reader :states,:number_of_runs,:context
463
463
  attr_accessor :setup,:teardown
464
464
  attr_writer :attended
465
465
 
466
466
  #setup and teardown are TestScenario instances that will run before and after each call
467
467
  #to the scenario.
468
- def initialize setup=nil, teardown=nil,logger=nil
468
+ def initialize context=nil,setup=nil, teardown=nil,logger=nil
469
469
  @setup=setup
470
470
  @teardown=teardown
471
471
  @attended=false
@@ -473,6 +473,7 @@ module Rutema
473
473
  @logger||=Patir.setup_logger
474
474
  @states=Hash.new
475
475
  @number_of_runs=0
476
+ @context=context || Hash.new
476
477
  end
477
478
 
478
479
  def attended?
@@ -483,6 +484,7 @@ module Rutema
483
484
  #Returns the result of the run as a Patir::CommandSequenceStatus
484
485
  def run name,scenario, run_setup=true
485
486
  @logger.debug("Starting run for #{name} with #{scenario.inspect}")
487
+ @context[:scenario_name]=name
486
488
  #if setup /teardown is defined we need to execute them before and after
487
489
  if @setup && run_setup
488
490
  @logger.info("Setup for #{name}")
@@ -509,6 +511,7 @@ module Rutema
509
511
  @states["#{name}_teardown"].sequence_id="#{@number_of_runs}t"
510
512
  end
511
513
  @number_of_runs+=1
514
+ @context[:scenario_name]=nil
512
515
  return @states[name]
513
516
  end
514
517
 
@@ -569,7 +572,7 @@ module Rutema
569
572
  def run_step step
570
573
  @logger.info("Running step #{step.number} - #{step.step_type}")
571
574
  if step.has_cmd? && step.cmd.respond_to?(:run)
572
- step.cmd.run
575
+ step.cmd.run(@context)
573
576
  else
574
577
  @logger.warn("No command associated with step '#{step.step_type}'. Step number is #{step.number}")
575
578
  end
@@ -24,6 +24,7 @@ module TestRutema
24
24
  assert_equal("error", step.error)
25
25
  assert_equal(:not_executed, step.status)
26
26
  assert_nothing_raised() { step.run }
27
+ assert_nothing_raised() { step.run("context") }
27
28
  assert_equal(:success, step.status)
28
29
  assert_nothing_raised() { step.reset }
29
30
  assert_equal(:not_executed, step.status)
data/test/test_system.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
+ require 'rubygems'
2
3
  require 'test/unit'
3
4
  require 'ostruct'
4
- require 'rubygems'
5
5
  require 'patir/command'
6
6
  require 'mocha'
7
7
 
@@ -144,9 +144,6 @@ module TestRutema
144
144
  end
145
145
  puts coord.to_s if $DEBUG
146
146
  end
147
-
148
- def test_report
149
- end
150
147
  end
151
148
 
152
149
  class TestRunner<Test::Unit::TestCase
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.5
4
+ version: 1.0.6
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: 2009-07-16 00:00:00 +02:00
12
+ date: 2009-09-04 00:00:00 +02:00
13
13
  default_executable: rutemax
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.6.0
23
+ version: 0.6.4
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: highline
@@ -80,7 +80,7 @@ dependencies:
80
80
  requirements:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
- version: 2.3.2
83
+ version: 2.3.3
84
84
  version:
85
85
  description: |-
86
86
  == DESCRIPTION:
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  requirements: []
188
188
 
189
189
  rubyforge_project: patir
190
- rubygems_version: 1.3.4
190
+ rubygems_version: 1.3.5
191
191
  signing_key:
192
192
  specification_version: 3
193
193
  summary: rutema is a test execution and management framework for heterogeneous testing environments