On Tue, Dec 18, 2012 at 6:18 PM, captin <[email protected]> wrote:
> and therefore I cannot log the error message to a file or grab a
> screenshot or anything else.
Rescuing exceptions so you can log the error message or take a screen shot
is the wrong way to do it. My test/unit-fu is pretty rusty, but you should
be able to create custom formatter (at least that is how I would do it in
RSpec or Cucumber). Is there a reason you are using test/unit instead of
RSpec or Cucumber?
That said, I have simplified the code that you have posted a bit, and it
rescues the exception on my machine.
require 'test/unit'
class TC_Sample < Test::Unit::TestCase
def test_01
begin
assert(false)
rescue Test::Unit::AssertionFailedError
puts "Batdog to the Rescue!"
end
end
end
The script rescues the exception if I use just "rescue" or "rescue
Test::Unit::AssertionFailedError".
$ ruby test.rb
Loaded suite test
Started
Batdog to the Rescue!
.
Finished in 0.017473 seconds.
1 tests, 1 assertions, 0 failures, 0 errors
$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]
What version of Ruby are you using?
Željko
--
https://leanpub.com/watirbook
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]