rutema 1.0.8 → 1.0.9

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.
@@ -1,3 +1,8 @@
1
+ == 1.0.9 / 2010-03-22
2
+ * Fixed (hopefully) a nagging bug in activerecord reporter where it would crash if a step had status nil.
3
+ * Fixed the same behaviour in the text reporter
4
+ * Improved the logging of steps to avoid a debug logging exception that messed logs up
5
+ * Thinned out the debug logs
1
6
  == 1.0.8 / 2009-11-13
2
7
  * ActiveRecordReporter now accepts all activerecord adapter parameters - you can now connect to DBs other than sqlite3
3
8
  * Reporter delegation now more robust (rutemax will exit gracefully and log if one reporter bombs)
@@ -96,7 +96,7 @@ module Rutema
96
96
  st=Model::Step.new
97
97
  st.name=step[:name]
98
98
  st.number=number
99
- st.status=step[:status].to_s
99
+ st.status="#{step[:status]}"
100
100
  st.output=sanitize(step[:output])
101
101
  st.error=sanitize(step[:error])
102
102
  st.duration=step[:duration]
@@ -24,6 +24,7 @@ module Rutema
24
24
  end
25
25
  msg<<"\n---"
26
26
  #Report on scenarios
27
+ runner_states.compact!#make sure no nil elements make it through
27
28
  msg<<"\nNo scenarios in this run" if runner_states.empty?
28
29
  msg<<"\nOne scenario in the current run" if runner_states.size==1
29
30
  msg<<"\n#{runner_states.size} scenarios in the current run" if runner_states.size>1
@@ -13,7 +13,7 @@ module Rutema
13
13
  module Version
14
14
  MAJOR=1
15
15
  MINOR=0
16
- TINY=8
16
+ TINY=9
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
@@ -144,7 +144,6 @@ module Rutema
144
144
  reqs.collect!{|r| r.attributes["name"]}
145
145
  spec.requirements=reqs
146
146
  #Get the scenario
147
- @logger.debug("Parsing scenario element")
148
147
  Dir.chdir(File.dirname(filename)) do
149
148
  spec.scenario=parse_scenario(xmldoc.elements[ELEM_SCENARIO].to_s) if xmldoc.elements[ELEM_SCENARIO]
150
149
  end
@@ -204,7 +203,6 @@ module Rutema
204
203
  end
205
204
 
206
205
  def add_attribute element,attr,value
207
- @logger.debug("Adding attribute #{attr} with value #{value}")
208
206
  if boolean?(value)
209
207
  element.attribute(attr,eval(value))
210
208
  else
@@ -292,21 +290,17 @@ module Rutema
292
290
  when :all
293
291
  @runner.attended=true
294
292
  specs=parse_all_specifications
295
- @logger.debug(specs)
296
293
  run_scenarios(specs)
297
294
  when :attended
298
295
  @runner.attended=true
299
296
  specs=parse_all_specifications
300
- @logger.debug(specs)
301
297
  run_scenarios(specs.select{|s| s.scenario && s.scenario.attended?})
302
298
  when :unattended
303
299
  specs=parse_all_specifications
304
- @logger.debug(specs)
305
300
  run_scenarios(specs.select{|s| s.scenario && !s.scenario.attended?})
306
301
  when String
307
302
  @runner.attended=true
308
303
  spec=parse_specification(mode)
309
- @logger.debug("Running #{spec}")
310
304
  run_test(spec) if spec
311
305
  else
312
306
  @logger.fatal("Don't know how to run '#{mode}'")
@@ -484,7 +478,8 @@ module Rutema
484
478
  @number_of_runs=0
485
479
  @context=context || Hash.new
486
480
  end
487
-
481
+
482
+ #Tells you if the system runs in the mode that expects user input
488
483
  def attended?
489
484
  return @attended
490
485
  end
@@ -530,7 +525,8 @@ module Rutema
530
525
  def [](name)
531
526
  return @states[name]
532
527
  end
533
-
528
+
529
+ #Resets the Runner's internal state
534
530
  def reset
535
531
  @states.clear
536
532
  @number_of_runs=0
@@ -582,28 +578,28 @@ module Rutema
582
578
  @logger.info("Running step #{step.number} - #{step.name}")
583
579
  if step.has_cmd? && step.cmd.respond_to?(:run)
584
580
  step.cmd.run(@context)
581
+ msg=step.to_s
582
+ if !step.cmd.success?
583
+ msg<<"\n#{step.cmd.output}" unless step.cmd.output.empty?
584
+ msg<<"\n#{step.cmd.error}" unless step.cmd.error.empty?
585
+ end
585
586
  else
586
587
  @logger.warn("No command associated with step '#{step.step_type}'. Step number is #{step.number}")
587
588
  end
588
- msg=step.to_s
589
- p step if $DEBUG
590
- # we might not have a command object
591
- if step.has_cmd? && step.cmd.executed? && !step.cmd.success?
592
- msg<<"\n#{step.cmd.output}" unless step.cmd.output.empty?
593
- msg<<"\n#{step.cmd.error}" unless step.cmd.error.empty?
594
- end
589
+ step.status=:success if step.status==:error && step.ignore?
590
+ log_step_result(step,msg)
591
+ return step
592
+ end
593
+ def log_step_result step,msg
595
594
  if step.status==:error
596
595
  if step.ignore?
597
- @logger.warn("Step failed but result is being ignored!")
598
- @logger.warn(msg)
599
- step.status=:success
596
+ @logger.warn("Step failed but result is being ignored!\n#{msg}")
600
597
  else
601
598
  @logger.error(msg)
602
599
  end
603
600
  else
604
- @logger.info(msg)
601
+ @logger.info(msg) if msg && !msg.empty?
605
602
  end
606
- return step
607
603
  end
608
604
  end
609
605
 
@@ -187,6 +187,7 @@ module TestRutema
187
187
  end
188
188
 
189
189
  def test_ignore
190
+ $DEBUG=true
190
191
  step=OpenStruct.new("status"=>:not_executed)
191
192
  step.stubs(:number).returns(1)
192
193
  step.stubs(:name).returns("mock")
@@ -197,7 +198,7 @@ module TestRutema
197
198
  step.stubs(:exec_time).returns(12)
198
199
  step.stubs(:has_cmd?).returns(false)
199
200
  step.expects(:ignore?).returns(true)
200
- step.expects(:status).times(5).returns(:not_executed).then.returns(:not_executed).then.returns(:error).then.returns(:warning).then.returns(:warning)
201
+ step.expects(:status).times(6).returns(:not_executed).then.returns(:not_executed).then.returns(:error).then.returns(:warning).then.returns(:warning)
201
202
  scenario=Rutema::TestScenario.new
202
203
  scenario.expects(:attended?).returns(false)
203
204
  scenario.stubs(:steps).returns([step])
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.8
4
+ version: 1.0.9
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-11-13 00:00:00 +01:00
12
+ date: 2010-04-07 00:00:00 +03:00
13
13
  default_executable: rutemax
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -72,6 +72,26 @@ dependencies:
72
72
  - !ruby/object:Gem::Version
73
73
  version: 1.1.1
74
74
  version:
75
+ - !ruby/object:Gem::Dependency
76
+ name: rubyforge
77
+ type: :development
78
+ version_requirement:
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 2.0.3
84
+ version:
85
+ - !ruby/object:Gem::Dependency
86
+ name: gemcutter
87
+ type: :development
88
+ version_requirement:
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: 0.3.0
94
+ version:
75
95
  - !ruby/object:Gem::Dependency
76
96
  name: hoe
77
97
  type: :development
@@ -80,7 +100,7 @@ dependencies:
80
100
  requirements:
81
101
  - - ">="
82
102
  - !ruby/object:Gem::Version
83
- version: 2.3.3
103
+ version: 2.5.0
84
104
  version:
85
105
  description: |-
86
106
  == DESCRIPTION: