jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clovis Yutaka Harada <clo...@scopus.com.br>
Subject RE: External Javascript files
Date Mon, 31 Mar 2003 14:25:50 GMT
I'm using httpunit 1.5 with jakarta-cactus-12-1.4.1.
I'll see if  there's other version of httpunit somewhere in the classpath.
The classpath is clean as it is set in the build.xml.

thanks,

Clovis


-----Original Message-----
From: Vincent Massol [mailto:vmassol@pivolis.com]
Sent: Saturday, March 29, 2003 7:08 PM
To: 'Cactus Users List'
Subject: RE: External Javascript files


Hi Clovis,

I don't know what's happening. I've checked line 105 of HTMLPage.java
(in CVS HEAD) but you must be using an older version of httpunit as it
doesn't match. I think this question should be asked on the HttpUnit
mailing list. Russell would be able to figure out what's happening
pretty quickly I would say.

Thanks
-Vincent

> -----Original Message-----
> From: Clovis Yutaka Harada [mailto:clovis@scopus.com.br]
> Sent: 19 March 2003 15:35
> To: cactus-user@jakarta.apache.org
> Subject: External Javascript files
> 
> 
> Hi list,
> 
> I´m using cactus 1.4.1 to test a web app.
> I´ve built some unit tests with cactus and junit and everything is ok.
> They are integrated with ant and cruise-control so all tests run every
> hour.
> 
> Now I´m doing some functional tests using cactus with httpunit and I´m
> having problems with external javascript files.
> 
> If i have something like:
> -----
> <SCRIPT language=JavaScript1.2 src="common/HM_Loader.js"
> type=text/javascript></SCRIPT>
> -----
> the test fails with this trace:
>     [junit] Testcase: testTelaMenu1 took 0.794 sec
>     [junit]     Caused an ERROR
>     [junit] null
>     [junit] java.lang.NullPointerException
>     [junit]     at
> com.meterware.httpunit.HTMLPage.getIncludedScript(HTMLPage.java:105)
>     [junit]     at
>
com.meterware.httpunit.DOMParser.getIncludedScript(NekoHTMLParser.java:1
17
> )
>     [junit]     at
> com.meterware.httpunit.ScriptFilter.startElement(ScriptFilter.java:87)
>     [junit]     at
org.cyberneko.html.HTMLTagBalancer.startElement(Unknown
> Source)
>     [junit]     at
> org.cyberneko.html.HTMLScanner$ContentScanner.scanStartElement(Unknown
> Source)
>     [junit]     at
> org.cyberneko.html.HTMLScanner$ContentScanner.scan(Unknown Source)
>     [junit]     at org.cyberneko.html.HTMLScanner.scanDocument(Unknown
> Source)
>     [junit]     at org.cyberneko.html.HTMLConfiguration.parse(Unknown
> Source)
>     [junit]     at org.cyberneko.html.HTMLConfiguration.parse(Unknown
> Source)
>     [junit]     at org.apache.xerces.parsers.XMLParser.parse(Unknown
> Source)
>     [junit]     at org.apache.xerces.parsers.DOMParser.parse(Unknown
> Source)
>     [junit]     at
> com.meterware.httpunit.NekoHTMLParser.parse(NekoHTMLParser.java:49)
>     [junit]     at
> com.meterware.httpunit.HTMLPage.parse(HTMLPage.java:249)
>     [junit]     at
>
com.meterware.httpunit.WebResponse.getReceivedPage(WebResponse.java:918)
>     [junit]     at
> com.meterware.httpunit.WebResponse.getForms(WebResponse.java:289)
>     [junit]     at
> iwse.controller.ControllerTest.endTelaMenu1(ControllerTest.java:280)
>     [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>     [junit]     at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:
> 39
> )
>     [junit]     at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Im
> pl
> .java:25)
>     [junit]     at
>
org.apache.cactus.AbstractWebTestCase.callEndMethod(AbstractWebTestCase.
ja
> va
> :177)
>     [junit]     at
>
org.apache.cactus.AbstractWebTestCase.runGenericTest(AbstractWebTestCase
.j
> av
> a:263)
>     [junit]     at
> org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:133)
>     [junit]     at
> org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:195)
> 
> 
> Note that, if I retrive the page with HttpUnit alone everything works
> fine.
> Also, if I put the javascript code inside the html page (insted of
loading
> in separate file) using:
> -----
> <script>
> <%@include file="HM_Loader.js" %>
> </script>
> -----
> the test run without any problem.
> 
> 
> I think it is obvious but here is the code that fails (with external
> javascript file):
> ---------
>     public void endTelaMenu1(
>             com.meterware.httpunit.WebResponse theResponse) throws
> Exception
> {
>         com.meterware.httpunit.WebForm form =
theResponse.getForms()[0];
>         assertEquals(reqScrambled, form.getParameterValue("CTL"));
>         assertEquals("-1", form.getParameterValue("NUMCC"));
>         assertEquals("-1", form.getParameterValue("NUMPP"));
> ---------
> 
> And here is the httpunit code that works (with external javascript
file):
> ---------
>     public void testTelaMenu() {
>             WebConversation wc = new WebConversation();
>             WebRequest     req =
>                 new GetMethodWebRequest(
> 
> "http://xxxxx:8080/xxx/xxxx/xxxxxx.asp?CTL=4272910994907");
>             WebResponse   resp = wc.getResponse(req);
>             WebForm form = resp.getForms()[0];
>             assertEquals(reqScrambled, form.getParameterValue("CTL"));
>             assertEquals("-1", form.getParameterValue("NUMCC"));
>             assertEquals("-1", form.getParameterValue("NUMPP"));
>     }
> ---------
> 
> Clovis
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org

Mime
View raw message