Would like to get some ideas on how to use HttpUnit in this kind of (already completed) web app project
"Gnanasekaran Sakthivel" <[email protected]> Wed, 14 Jan 2009 18:38:13 -0500
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
In our application:
Almost all web pages have javascripts. A good bunch of these scripts are
called by <body onload="..." ../>. In addition we have few AJAX scripts as
well, which gets fired when user chooses something on the page..etc.
Another important thing is, all our page/form submits are through one
javascript method triggered through onclick event associated to
images/links.
This (form submit) javascript sets some passed-in values to couple of form
hidden-parameters and calls document.forms[..].submit().
All the web pages (with Html Forms) of this Entire application are like
this.
Do anyone have any idea how to use HttpUnit in this (already developed)
project. Or will it be better to use someother tool.
Right now, I am using eclipse 3.2, build-deploy this web application; I have
a (HttpUnit) testing project in the same eclipse workspace; thinking of
creating test cases and suites and run them this way.
*Extract of one of my test case:*
*WebResponse loginResponse = GeneralUtil.logMeInDefault (); // This logs me
in
*
* if (loginResponse == null) {
**fail ("Default Login process failed");
*
*}
*
*
**// Following lets me choose a main link (or start a
use-case/functionality) from the standard menu
*
*TableRow applicantCreateRow =
LeftNavMenuSelector.getMenuItemTableRow(loginResponse,
*
*TestConstants.menuItemApplicantText,
*
*TestConstants.menuItemApplicantCreateText);
*
*
**//applicantCreateRow.handleEvent ("onclick"); // This onclick on a HTML
Table row calls this form submit javascript and gets the respose.. I cannot
do this because i cannot get WebResponse after this...
// So I should be faking this some other way
// I am faking the javascript form submit as below:
WebForm[] forms = loginResponse.getForms();
WebForm applicantCreateForm = loginResponse.getForms()[0];
forms[0].getScriptableObject().setParameterValue("hiddenparameter",
"applicationIndex"); // hidden form parameter.
WebResponse applicantCreateResponse = forms[0].submit();
*
Just would like to know if someone have any better idea. I am asking a favor
because I am completely new to writing test cases etc...
It would be great to get some ideas from experts.
*Thank you*
--
Good day
(Edison Paul) Gnanasekaran Sakthivel
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop