wood burning stoves 2.0*
The moose likes Testing and the fly likes HttpUnit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "HttpUnit" Watch "HttpUnit" New topic
Author

HttpUnit

Vid Srini
Ranch Hand

Joined: Aug 17, 2006
Posts: 35
Hi All,

In my real application, 3 javascript methods are fired during the button click event for validation before submission of a page.

For testing,I used HttpUnit.I couldnt submit the page.DOES HTTPUNIT HAS PROBLEM WITH COMPLEX JAVASCRIPT FUNCTIONS.

CAN SOME ONE SUGGEST ME WHICH JAVA BASED TOOL CAN BE USED FOR TESTING WEB BASED STRUTS APPLICATIONS WITH JAVASCRIPT FUNCTIONS.

Thanks a lot,
Vidhya
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41020
    
  43
JavaScript support in HttpUnit is limited. Are you using any of the functionality mentioned on that page? What is the instruction where execution fails/stops?

My understanding is that HtmlUnit has better JS support (or rather, DOM support, since basic JS support for both is provided by Rhino, and thus identical) now than HttpUnit, although I've no experience with that.

By the way, please don't post in all-uppercase letters. It's unnecessarily hard to read, and considered to be "shouting", and thus not a nice thing to do.
[ March 20, 2007: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Vid Srini
Ranch Hand

Joined: Aug 17, 2006
Posts: 35
Hi Ulf,

Thanks for correcting my mistake. I will not repeat the same in my future posts.


I have a screen with 5 select boxes and 2 text boxes.I need to select the values and submit the page.During the submission,javascript validations are done.This is the functionality of the page.

When I run the httpunit program in Eclipse,the form is not submited.

Sample code is below :-

SubmitButton continueButton = form.getSubmitButton("xxxx", "xxx");
WebRequest r1=form.getRequest(xxxx);
WebResponse resp1=wc.getResponse(r1);
resp1=form.submit(xxxx);


I am able to rereive the name of the button in the form,but the page is not submitted...

please throw some inputs on this issue....


Thanks,
Vidhya.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41020
    
  43
It makes little sense to retrieve the request and response before submitting the form.

What happens after the submit call? Are there any exceptions? Should any JavaScript methods get called before submission? We don't know your page so be sure to mention the relevant details.
Vid Srini
Ranch Hand

Joined: Aug 17, 2006
Posts: 35
Hi Ulf,

Beore Page Submission ----> JavaScript Validations are done on TextBoxes

After Page Submission ------> Calculation is performed and output displayed to the user.

When we click the submit button,no action is taking place.Also it is not throwing any exceptions.

So couldnt trace the root of the problem.

Help me out to trace the problem
Thnks,
Vidhya
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41020
    
  43
As I said, don't retrieve the response before submitting the form. So if you have code like

WebResponse resp1 = form.submit(xxxx);

what is contained in resp1? If no exception is thrown there must be something in it, or is it null?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpUnit
 
Similar Threads
Better JavaScript support than HtmlUnit?
Httpunit button.click() not working
Data mining a webpage
HttpUnit , Javascript Errors
Which Functional Test Tool Has best Javascript Support