File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Test html:cancel with STRUTSTESTCASE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Test html:cancel with STRUTSTESTCASE" Watch "Test html:cancel with STRUTSTESTCASE" New topic
Author

Test html:cancel with STRUTSTESTCASE

Jiao Yu
Greenhorn

Joined: Oct 27, 2003
Posts: 7
Hello,

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

Thanks a lot and have a great day,

Jiao
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

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.
Jiao Yu
Greenhorn

Joined: Oct 27, 2003
Posts: 7
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");

This behaviour is emulated.

BTW, I means "MockStrutsTestCase".

Thanks for your reply and have a great day,


Jiao
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Test html:cancel with STRUTSTESTCASE