Permalink
Browse files

Reports on errors that occur during an after block exception

  • Loading branch information...
1 parent 7775da6 commit 63b5ba97f1a3cecc5fc40d6f042fe1d34f66cb1e @mattwynne committed May 19, 2009
@@ -0,0 +1,12 @@
+Feature: Generate After Block Exception
+ In order to test that exceptions in after blocks are reported by testjour
+ As a testjour developer
+ I want to cause the After block to raise an exception
+
+ Scenario: Raise After block exception
+ Given I am a naughty step
+
+
+
+
+
@@ -10,16 +10,16 @@
if n == "asd"
raise "error!!"
end
- sleep 0.3
+ sleep 0.1
@calc.push n.to_i
end
When /I press (\w+)/ do |key|
- sleep 0.3
+ sleep 0.1
@calc.send(key.intern)
end
Then /the result should be (.*) on the screen/ do |result|
- sleep 0.3
+ sleep 0.1
@calc.screen.should == result.to_i
end
@@ -0,0 +1,11 @@
+Given /^I am a naughty step$/ do
+ @naughty = true
+end
+
+class NaughtyScenarioException < Exception; end
+
+After do
+ if @naughty
+ raise(NaughtyScenarioException.new("I have been very very naughty"))
+ end
+end
@@ -116,6 +116,8 @@ def visit_multiline_arg(multiline_arg) #:nodoc:
end
def visit_exception(exception, status) #:nodoc:
+ Testjour.logger.debug "visit_exception"
+ Testjour.logger.debug "visit_exception done"
end
def visit_py_string(string)
@@ -163,6 +165,11 @@ def visit_step(step)
end
end
+ def visit_exception(exception, status) #:nodoc:
+ Testjour.logger.warn "#{exception.message}\n\n#{exception.backtrace.join("\n")}"
+ progress(0, :failed, exception)
+ end
+
def visit_table_row(table_row)
row_start = Time.now
super

0 comments on commit 63b5ba9

Please sign in to comment.