You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by bh...@wipro.com on 2006/10/10 11:32:45 UTC

Help needed in writing Junit test case for Struts when DynaValidator form is used



Hi,



 Iam writing   Junit  test case for Struts application using cactus

and iam using  dynavalidator form

and have written test case given below





public void testSuccessfulLogin() {

   setRequestPathInfo("/login");

   addRequestParameter("userId","bhanu");

   actionPerform();

   verifyForward("success");

   verifyForwardPath("/messages.jsp");

   assertEquals("bhanu",getSession().getAttribute("User ID"));

   verifyNoActionErrors();

 }



and in the test case if iam using

addRequestParameter("userId","bhanu");

the Dynvalidator form is not getting populated

i.e if iam retrieving  value  using getSession().getAttribute("User ID")
iam getting null

but if am writing a nomal loginform  and using it

instead of  dynavalidator form the loginform is getting

populated and iam able to retrive value using

getSession().getAttribute("User ID")



Please tell me how to write testcases in struts  when  DynaValidator
form is used 



Thanks and Regards

Bhanuprakash




The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com