wood burning stoves
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

Test html:cancel with STRUTSTESTCASE

Jiao Yu

Joined: Oct 27, 2003
Posts: 7

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,

Marc Peabody
pie sneak

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

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:

This behaviour is emulated.

BTW, I means "MockStrutsTestCase".

Thanks for your reply and have a great day,

I agree. Here's the link: http://aspose.com/file-tools
subject: Test html:cancel with STRUTSTESTCASE
It's not a secret anymore!