Re: related javascript files not fetched

<[email protected]> Mon, 17 Aug 2009 17:44:37 -0500
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <047619DE22807D4192B0B9EB64E45CC124853FF371@MSGCMSV21024.ent.wfb.bank.corp>
My prior complaint about it not loading javascript files
seems to have been transient, a SVN update has fixed it.

However, the second part of my question was more
about a 404 on javascript files, if you look at
the following test there is no exception thrown
even though xyz.js does not exist.

 public void testBadJavascriptFile() throws Exception {
   defineResource("OnCommand.html",
     "<html><head>" +
     "<script language='JavaScript' src='xyz.js'></script></head>" +
     "<body>Hello</body></html>" );
   HttpUnitOptions.setExceptionsThrownOnErrorStatus(true);
   HttpUnitOptions.setExceptionsThrownOnScriptError(true);
   HttpUnitOptions.clearScriptErrorMessages();
   WebConversation wc = new WebConversation();
   wc.setExceptionsThrownOnErrorStatus(true);
   try {
     WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
     fail("there should have been an exception");
   } catch (Throwable th) {
       th.printStackTrace();
     // not sure what to expect here, currently no expection is produced
   }
 }


Also HttpUnitOptions.getScriptErrorMessages() does not show
any errors, but a WebClientListener will show a 404 from the server.

Thanks,
Dan


> Wolfgang Fahl wrote:
> Dan wrote: 
> > The current version of HttpUnit in Subversion does not seem to be 
> > fetching the related javascript files. I don't see the hits in the 
> > access log of my server or in my WebClientListener.The 
> > 1.7 version definitely fetched these, as did the older version I have. 
> > This seems like it must be a bug. It can't do any javascript processing 
> > if it doesn't download the javascript files. 
> 
> The JUnit Test ScriptingTest.java 
> does have several test cases that include 
>   <script language='JavaScript' src='saycheese.js'> 
> statements. So one question would be what kind of html statement you'd expect do the pickup. 
> 
> You might want to add a test to 
> https://httpunit.svn.sourceforge.net/svnroot/httpunit/trunk/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java  to show what the issue is that you might want to get fixed. It might have to do with the bug fix for 1055450 
> that explicitly called for being able to bypass script file loading errors. 
> 
> > (my next question is going to be how to detect javascript errors 
> > and missing javascript files, but it seems this has to be resolved 
> > first) 
> 
> Hope the above helps to figure out what your needs are. 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july