Re: how to test / WebResponse creating by reading a filesystem resource

Russell Gold <[email protected]>
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
On Dec 13, 2006, at 12:06 PM, Maciej Zywno wrote:

> Hi,
>
> I want to test a method that extracts various forms, fields etc  
> from a WebResponse to make sure that this method extracts the info  
> as I expect it to do. I wanted to avoid the test methods doing any  
> network connections. So I though I could download html, store them  
> on a hard drive and let test methods use them. However when I pass  
> filesystem urls to WebConversation.getResponse(url), there is a  
> problem with embedded javascript. One javascript includes the other  
> on various levels. It seems it may not be so easily downloaded by  
> hand as urls to thos javascripts are generated dynamically.
>
> I would like to ask about your approach to testing code that uses  
> WebResponse and other httpunit classes. Any hints? Do you stub a  
> WebResponse somehow? Did you manage to store It seems like mu unit  
> tests will have to connect to a real webportal to create a  
> WebResponse object. Do you have any solution to that?
>

Have you looked at the test code? It uses a PseudoServer to server  
requests - shouldn't ever actually go to the network in most  
implementations, I believe. Definitely does not require a real web  
portal. The tests are in the "test" directory of the archive.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.