Hi,
I was trying to test out my application by sending
consecutive requests with varying attribute values for
the ActionForm.
If there is an ActionError(s) logged in any of the one
actions, every consequent actionPerform() gives the
same error.
E.g.
form.setUserName("correctLogin");
form.setPassword("correctPassword");
setActionForm(form);
actionPerform();
//everything is fine, so no errors
form.setUserName("wrongLogin");
form.setUserName("wrongLogin");
setActionform(form);
actionPerform();
//worng login info, so errors are logged.
From hereon whatever is given from the testcase will
return the same ActionError defined earlier
Looks like the ActionErrors in the request/response is
not being
re-intialised once an error is set to it.
I am struggling with this problem.
Would urge you to look into this and try fixing it.
Regards,
Hayath
(hayath.m@gmail.com)
Logged In: NO
Hi,
I was able to track down and fix the problem. The problem
was solved by setting a new ActionErrors() object for every
actionPerform()
Here is the code fix in the MockStrutsTestCase class's
actionPerform()
actionPerform()
{
try {
//Fix for the problem
request.setAttribute(org.apache.struts.Globals.ERROR_KEY,new
ActionErrors());
this.getActionServlet().doPost(request,response);
}catch (NullPointerException npe) {
}
Cheers,
Hayath
(hayath.m@gmail.com)
Logged In: NO
Hi Hayath,
It might help if you removed the errors or messages from the
session by calling
request.getSession().removeAttribute(GLOBALS.MESSAGE_KEY) or
request.getSession().removeAttribute(GLOBALS.ERROR_KEY) as
this isnt really a serious bug.
HTH
EE