On Tue, Mar 24, 2009 at 01:04:17PM -0700, watirRookie wrote:
> 
> hello,
> I am fairly new to watir and ruby in general. I am trying to automate
> some web testing that requires to check for the existing of certain
> html elements. So I am using the following code in my def:
> 
> #
> def validate_header_login_page
>   begin
>         assert($ie.div(:id, "header").exists?)
>           puts (" header Test Passed")
>         rescue => e
>           puts(" header Test Failed" + "\t\t" + e.message)
>   end #begin
> end #def
> #
> 
> The problem I am having is that if a certain element does not exist or
> if I am doing negative test such as:
> assert($ie.div(:id, "headerxyz").exists?)
> 
> the header test puts the failing comment but I don't get the metrics
> correct in the end.
> 3 tests, 5 assertions, 0 failures, 0 errors
> 
> Does anyone know how to put the failing comment and also increment the
> fail metrics so it looks like:
> 3 tests, 5 assertions, 1 failures, 0 errors
> 
> Thanks,
> uj

Hi uj,

This should be enough for test/unit to report the failure correctly:

def validate_header_login_page
  assert($ie.div(:id, 'header').exists?, 'Header test failed')
end

The rescue block is not necessary, and since your code is going there I
think there's a deeper problem in your script.  Can you show the full
text of your failing comment?


- Anna


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to