If my jsp page, I have two buttons, one is html:submit, the other one is html:cancel, how could I create a test case for html:cancel? In my Action, I am using :if (isCancelled(request)) to determine whether the html:cancel is pushed, but I don't know how to setup this html:cancel button in my testcase. BTW, I am using mocktestcase
I'm confused. What do you mean that you don't know how to setup html:cancel in a test case? And what is mocktestcase?
A good workman is known by his tools.
Joined: Oct 27, 2003
Sorry for confusing you.
What I am trying to say is "how to emulate the behaviour of clicking the cancel button in STRUTSTESTCASE".
I have figured it out, basically, ActionServlet decides whether the user clicks the cancel button by checking a request parameter with the key of "org.apache.struts.taglib.html.CANCEL" in resource bundle.
So if we add following request parameter in our testcase: addRequestParameter(Constants.CANCEL_PROPERTY,"CANCEL");