Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Test html:cancel with STRUTSTESTCASE

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic