Dave Silvester wrote:> David Teare wrote: > >> I was wondering if there was a helper method that would parse the >> response and validate all links on the page worked (i.e. returned >> success). Does such a method already exist somewhere? > > > Not a helper method or even a part of Rails, and I hope you already know > about it, but just in case: > > http://validator.w3.org/checklink > > Pretty quick way of finding dead links, especially when you get it to > recursively check an entire site.If your site is not available to the outside world, here are two suggestions: If on Windows, look at WaTiR. You can write simple scripts to launch IE, navigate to a URL, and check each link. (It''s useful for far more than that, though obviously limited by OS/browser.) Also consider using WWW::Mechanize to fetch a page, loop over the links collection, and see that each one is properly available. http://www.clabs.org/wtr/index.cgi?page=/WaTiR http://rubyforge.org/projects/wee (Mechanize is grouped under Wee) James -- http://www.ruby-doc.org - The Ruby Documentation Site http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML http://www.rubystuff.com - The Ruby Store for Ruby Stuff http://www.jamesbritt.com - Playing with Better Toys
Hi all, I''ve been writing tests for my application all weekend and have had some instances where all my tests pass, but the user still manages to find some dead links on the page. I was wondering if there was a helper method that would parse the response and validate all links on the page worked (i.e. returned success). Does such a method already exist somewhere? Thanks!
David Teare wrote:> I was wondering if there was a helper method that would parse the > response and validate all links on the page worked (i.e. returned > success). Does such a method already exist somewhere?Not a helper method or even a part of Rails, and I hope you already know about it, but just in case: http://validator.w3.org/checklink Pretty quick way of finding dead links, especially when you get it to recursively check an entire site. HTH a little bit! :-) ~Dave -- Dave Silvester Rent-A-Monkey Website Development Web: http://www.rentamonkey.com/
Thanks for the feedback. My thought was to integrate this into the functional tests of each view s.t. all links are tested before going to production. I will look at Mechanize and see if I can leverage it. My only concern is it might be really slow testing all links on all pages. On 24-Jul-05, at 9:01 PM, James Britt wrote:> Dave Silvester wrote: > >> David Teare wrote: >> >>> I was wondering if there was a helper method that would parse >>> the response and validate all links on the page worked (i.e. >>> returned success). Does such a method already exist somewhere? >>> >> Not a helper method or even a part of Rails, and I hope you >> already know about it, but just in case: >> http://validator.w3.org/checklink >> Pretty quick way of finding dead links, especially when you get it >> to recursively check an entire site. >> > > If your site is not available to the outside world, here are two > suggestions: > > If on Windows, look at WaTiR. You can write simple scripts to > launch IE, navigate to a URL, and check each link. (It''s useful > for far more than that, though obviously limited by OS/browser.) > > Also consider using WWW::Mechanize to fetch a page, loop over the > links collection, and see that each one is properly available. > > http://www.clabs.org/wtr/index.cgi?page=/WaTiR > http://rubyforge.org/projects/wee (Mechanize is grouped under Wee) > > > James > > -- > > http://www.ruby-doc.org - The Ruby Documentation Site > http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML > http://www.rubystuff.com - The Ruby Store for Ruby Stuff > http://www.jamesbritt.com - Playing with Better Toys > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >