This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Testing and the fly likes how to test struts with Junit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "how to test struts with Junit" Watch "how to test struts with Junit" New topic
Author

how to test struts with Junit

reena Mehta
Greenhorn

Joined: Nov 17, 2010
Posts: 24
i am new in testing
kindly give one example of test strutsApplicatio with Junit .it's urgent
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Honestly speaking, I never unit tested Struts app, but unit test are there for testing your business class (model) methods (unit). To test the controller (action) classes, please Google.

Please Google any junit tutorials and get started. happy Testing.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30356
    
150

I use JUnit and a mock testing framework (like easymock) to test the logic in my actions. For the web layer, you can use a tool like Selenium or Cactus.

Testing a Struts application is just like testing any other web app. And for mocking, like testing any other code.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
xsunil kumar
Ranch Hand

Joined: Dec 14, 2009
Posts: 133
You can use Easy mock for testing Struts and Http request.You need to create mock object of request and response. Search in google you will get ton of sample.
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 512
Hi,
You can use StrutsTestCase . But I am afraid it is meant for Struts 1.x versions.

Regards,
Amit
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to test struts with Junit