[Wtr-general] <nil> is not true with assert(ie.contains_text)
Charley Baker
charley.baker at gmail.com
Mon Jun 12 11:20:48 EDT 2006
That's because you're swallowing the exception in your rescue clause. You
want it to be raised and caught by Test::Unit so that it can see it for
reporting. You need to either get rid of the rescue and ensure blocks or
rethrow the exception (in which case you might want to wrap the original
exception).
raise Test::Unit::AssertionFailedError,
"in my testcase: #{e.message}",
e.backtrace
-Charley
On 6/12/06, Adrian Rutter <Adrian.Rutter at tnt.com> wrote:
>
>
> Brett wrote
> > You are referencing a buggy version of our documentation. Please see
> >http://wtr.rubyforge.org/watir_user_guide.html
>
> But if the text is not found,
>
> e.g.
> require 'watir'
> require 'test/unit'
> class TC_1 < Test::Unit::TestCase
> def test_1
> ie = Watir::IE.new
> ie.goto('www.tnt.com')
> assert(ie.contains_text ("ZXVX"))
> rescue => e
> puts(e.message + "\n" + e.backtrace.join("\n"))
> ensure
> ie.close
> end
>
> end
>
>
> An exception is raised and this non-failure is presented in the console
>
> 1 tests, 1 assertions, 0 failures, 0 errors
>
> Cheers
>
> Aidy
>
>
>
>
> ---------------------------------------------------------------------------------------------------------------
> This message and any attachment are confidential and may be privileged or
> otherwise protected from disclosure.
> If you are not the intended recipient, please telephone or email the
> sender and delete this message and any attachment from your system.
> If you are not the intended recipient you must not copy this message or
> attachment or disclose the contents to any other person.
>
> ---------------------------------------------------------------------------------------------------------------
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060612/6440a6fe/attachment.html
More information about the Wtr-general
mailing list