HttpUnit Testing

I am trying to write HttpUnit test case for a JSP page. The JSP page is a Struts JSP page with struts tags. The JSP page has following structure
< html: form action = "/something.do">
<table>
<tr><td><html:text property = "prop1" />Prop1</td></tr>
<tr><td><html:text property = "prop2" />Prop2</td></tr>
<tr><td><html:image alt = "Add" src= "../images/add.gif" property="add"></html:image>
</td></tr>
</table>

I would the testcase to show the clicking of the add button. How do I do this?? I am not able it to recognise the source of the image and invoke submit . Any sample code that would tell me how to do this would be good.

Thanks

Ramani



ramani081399Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kiranhkCommented:
if you have Struts then u would be better off using StrutsTestCase

This has all the info for testing your jsp

http://strutstestcase.sourceforge.net/
0
ramani081399Author Commented:
Kiranhk,
   I have gone to this site and I dont find any useful material. I need to test my JSP pages.
   So, I need to still solve my problem.
Ramani
0
kiranhkCommented:
what do u mean didnt fine any userful material. r u looking for something which validates your JSP to see if everything is correct in the JSP or do you want to test whether the control is going proprely to the jsp's
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

ramani081399Author Commented:
Yes the link that u mention does not give me the code to start off. I need to test the JSP page in a portlet environment. I can get all other things like validation and checking if the fields exist or not in the JSP page

Ramani
0
bloodredsunCommented:
Have you considered Cactus?
http://jakarta.apache.org/cactus/

It provides the extension for JUnit testing but for severside code such as servlets or jsps

http://enhydra.objectweb.org/doc/5.1/Tools/Cactus/howto_jsp.html : for a jsp specific article
0
kiranhkCommented:
bloodredsun

Strutstestcase is built on top of Cactus Mock Objects....

Anyway the sample code for StrutsTestCase can be found in these articles

http://www.onjava.com/pub/a/onjava/2004/09/22/test-struts.html?page=last

http://www.devx.com/Java/Article/20198/1954?pf=true

http://javaboutique.internet.com/tutorials/StrutsTestCase/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kiranhkCommented:
can you close this question... its been more than 3 months...........
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.