you may want to look at the log4r http://log4r.sourceforge.net/ to have an 
oject that take care of loging your reports. It may be overkill.

Most of my test use the 'rescue => e' way       
                
example 

            expected = "hello" #some text on the homepage
                @@log.info "Expected: Home page Page"
                begin
                       @@ie.goto(homepageurl)
                     
                        assert(@@ie.contains_text(expected))
                        @@log.info "PASS"
                rescue => e
                        @@log.info "FAIL"
                end     



I'm not sure the way below is better, here is a fragment

                                begin
                                        assert_nothing_raised(){
                                                (@@ie.link(:text, 
link_name).click)
                                        }       
                                        @@log.info "PASS: got down to 
#{link_name}"
                                rescue => e
                                        @@log.info "FAIL: did not get to 
#{link_name}"
                                end     

cheers
Pierre garigue



-----Original Message-----
From: Sy Ali [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 26, 2005 1:30 PM
To: [email protected]
Subject: Re: [Wtr-general] getting the HTTP status


On 10/21/05, Pierre Garigue <[EMAIL PROTECTED]> wrote:
> I because I 'rescue' everything, getting a 500 or 404 would just give me a 
> fail. I would like to add info to the log that is failed and got this http 
> status.

I too am using the basic "rescue" technique, which doesn't really give
me a whole lot to work with.  I read through the technical docs[1] and
couldn't find anything more specific.  Perhaps this feature does not
exist?

I wonder what would happen if I turned on friendly error messages ..
then if rescue catches the error, could I scan the page or title to
determine the nature of the error?

Here is my "go to" method, used with
goto("http://example.org/foo/bar.html";) or goto(variable).  It's
different than yours because it notices succesfully-loaded, but
redirected pages:

def goto(url)
        begin
                puts "* going to " + url
                $ie.goto(url)
        rescue
                puts ">>>ERROR"
        else
                puts "   ok, destination loads"
        end
        if $ie.url() == url
                puts "   ok, I stayed at the destination url"
        else
                puts "   warning: rewriting or redirection took effect"
        end
end


[1] http://wtr.rubyforge.org/rdoc/index.html

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general


_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to