Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > HTTPUnit and JavaScript - what are the limitations?

Reply
Thread Tools

HTTPUnit and JavaScript - what are the limitations?

 
 
AS
Guest
Posts: n/a
 
      10-26-2006
Hi all,

I've just tried to test a web application with HTTPUnit but seem to
have encountered an obstacle I can't overcome.

The webpage relies strongly on JavaScript (well, which one doesn't
nowadays?), for example by calling JavaScript functions instead of
containing traditional anchors. No rocket science involved, in fact.

However, after I'd found it impossible to follow such a link with
HTTPUnit:

java.lang.RuntimeException: No such property: name at
com.meterware.httpunit.scripting.ScriptableDelegat e.set(ScriptableDelegate.java:99)
at com.meterware.httpunit.FormControl$Scriptable.set( FormControl.java:391)
at
com.meterware.httpunit.TextFormControl$Scriptable. set(FormControl.java:793)
at
com.meterware.httpunit.javascript.JavaScript$JavaS criptEngine.put(JavaScript.java:275)
at
org.mozilla.javascript.ScriptableObject.putPropert y(ScriptableObject.java:1476)
at org.mozilla.javascript.ScriptRuntime.setProp(Scrip tRuntime.java:842)


I found a single post in HTTPUnit's mailing list stating that it's
impossible to set fields in JavaScript, only to read fields.
(http://sourceforge.net/mailarchive/f...&forum_id=5833)

I must confess I can't believe it's true - I can't imagine so many
people using (and praising) HTTPUnit if it doesn't implement this basic
and crucial functionality.

Has anyone encountered a similar problem before?

Thanks for any help,


Anna Skawinska
 
Reply With Quote
 
 
 
 
andrewmcdonagh
Guest
Posts: n/a
 
      10-28-2006


On Oct 26, 2:42 pm, AS <askawinska@_wytnij_to_sst.pl> wrote:
> Hi all,
>
> I've just tried to test a web application with HTTPUnit but seem to
> have encountered an obstacle I can't overcome.
>
> The webpage relies strongly on JavaScript (well, which one doesn't
> nowadays?), for example by calling JavaScript functions instead of
> containing traditional anchors. No rocket science involved, in fact.
>
> However, after I'd found it impossible to follow such a link with
> HTTPUnit:
>
> java.lang.RuntimeException: No such property: name at
> com.meterware.httpunit.scripting.ScriptableDelegat e.set(ScriptableDelegate.java:99)
> at com.meterware.httpunit.FormControl$Scriptable.set( FormControl.java:391)
> at
> com.meterware.httpunit.TextFormControl$Scriptable. set(FormControl.java:793)
> at
> com.meterware.httpunit.javascript.JavaScript$JavaS criptEngine.put(JavaScript.java:275)
> at
> org.mozilla.javascript.ScriptableObject.putPropert y(ScriptableObject.java:1476)
> at org.mozilla.javascript.ScriptRuntime.setProp(Scrip tRuntime.java:842)
>
> I found a single post in HTTPUnit's mailing list stating that it's
> impossible to set fields in JavaScript, only to read fields.
> (http://sourceforge.net/mailarchive/f...2817744&forum_...)
>
> I must confess I can't believe it's true - I can't imagine so many
> people using (and praising) HTTPUnit if it doesn't implement this basic
> and crucial functionality.
>
> Has anyone encountered a similar problem before?
>
> Thanks for any help,
>
> Anna Skawinska


Hi Anna,

Personally, I gave up with HTTPUnit in favour of the following.....


1) JUnit for testing the Java at the unit test level.
By this I mean, writing JUnit tests for each class within the project.
I didn't Unit test the View (HTTP) part of my application, just the
Model and Presenter logic.

2) I use Selenium for Acceptance tests (aka Integration/system tests),
Selenium drives web apps directly via the browser, just like a human
would use them, but obviously its automated. These tests cover the
View part of the application that the unit tests do not.


Regards

Andrew

http://www.openqa.org/selenium/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HttpUnit - JavaScript - iFrames kalensr Java 1 11-04-2005 08:58 PM
Httpunit help? Maintaining sessions/cookies. John Laury Java 0 11-18-2003 05:54 PM
HttpUnit JWebUnit for WAP apps DNasmars Java 0 08-26-2003 04:46 PM
Re: HttpUnit throws java.lang.NoSuchMethodError as soon as I attempt to create a WebConversation. Neomorph Java 0 08-14-2003 10:12 AM
httpUnit Tom Koenning Java 1 07-24-2003 08:28 PM



Advertisments