• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can we perform unit testing with JUnit for Struts1 application

 
p hasini
Ranch Hand
Posts: 92
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do we perform unit testing for Struts1 application.Is it done by writing JUnit test cases?How do we write these test cases for Struts1
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Short answer: yes.

Longer answer: yes, but how easy it is depends on how well structured the application is.

Personally, I rarely test Struts 1 actions themselves--too complicated. Things like StrutsTestCase can help in that regard. The bulk of application functionality, however, should really live in service objects (or whatever terminology you prefer), such that they can be tested outside of Struts, and without the cognitive overhead of mocking the Struts infrastructure. Actions can be tested by something like Selenium, serving the dual purpose of making sure you're getting the right responses back from the action and the correct view is shown in the browser.
 
p hasini
Ranch Hand
Posts: 92
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But StrutsTestCase can be used only with Struts 2.0 framework I think ,cannot use it with Struts1.

Can we use Cactus to test Struts1 Actions?

How do we test the business logic objects.

Please reply
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the home page of strutstestcase:
StrutsTestCase is compliant with the Java Servlet 2.2, 2.3, and 2.4 specifications, and supports Struts 1.2/1.3, and Cactus 1.7 and JUnit 3.8.1.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic