Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

HTTPUnit and JavaScript - what are the limitations?

Thread view: 
AS - 26 Oct 2006 14:42 GMT
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.ScriptableDelegate.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$JavaScriptEngine.put(JavaScript.java:275)
at
org.mozilla.javascript.ScriptableObject.putProperty(ScriptableObject.java:1476)
at org.mozilla.javascript.ScriptRuntime.setProp(ScriptRuntime.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/forum.php?thread_id=2817744&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
andrewmcdonagh - 28 Oct 2006 22:13 GMT
> Hi all,
>
[quoted text clipped - 32 lines]
>
> 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/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.