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

How to easily test a Struts Action?

 
gao zhixin
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I'm working with struts, and I want to test my action class, but I need to mock a HttpRequest object, a HttpResponse object, a ActionForm object, and a ActionMapping object, it's too difficult for me to test. Is there anything more easy?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dunno... let's go over to the Struts forum and ask over there (I'll move this thread for you.)
 
alan wamser
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by mock? Why not just download tomcat and use it to test your action?

http://localhost/webapp/action.do
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Apache Cactus is a test framework made specifically for testing Web applications. It builds on JUnit and works great for unit testing Struts applications.

Here's the link:

http://jakarta.apache.org/cactus/
[ January 30, 2006: Message edited by: Merrill Higginson ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic