Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Test html:cancel with STRUTSTESTCASE

 
Jiao Yu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jiao Yu
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic