[
https://issues.apache.org/jira/browse/WW-3711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13166843#comment-13166843
]
Miguel Almeida commented on WW-3711:
------------------------------------
{quote}
Also - from an architectural standpoint - mixing Struts Actions with database
functionality might not be the best choice. Instead, one might want to have
database dependent functionality in DAOs and or Services which then get
injected in Actions.
{quote}
The main usage of this class is BDD/Specification by example/integration tests
(pick your poison). While you can - and should have DAOs and Services and use
the Dependency Injection pattern, if you want to test at this level you'll
probably use the database too.
Similarly, every other test case already included (StrutsTestCase,
StrutsSpringTestCase) is already an integration test: at unit test level, you
should only be hitting the Action and not any other struts internals. In the
end, you probably should need both: unit tests that only touch your action and
don't need to extend any of this Test classes and more integrated tests for the
higher level tests where these classes are useful.
> StrutsSpringTransactionalTestCase - adding transactional behaviour to
> StrutsSpringTestCase
> ------------------------------------------------------------------------------------------
>
> Key: WW-3711
> URL: https://issues.apache.org/jira/browse/WW-3711
> Project: Struts 2
> Issue Type: New Feature
> Components: Unit Tests
> Affects Versions: 2.2.3.1
> Reporter: Miguel Almeida
> Priority: Minor
> Labels: spring, struts2, test-patch
> Fix For: 2.5
>
> Attachments: StrutsSpringTransactionalAbstractTest.java
>
>
> From the mailing list thread:
> I'm using StrutsSpringTestCase for some under-the-skin tests.
> However, I felt the need to set up my database for a test. My tests that need
> the database extend from AbstractTransactionalJUnit4SpringContextTests, which
> makes them transactional.
> I therefore created a StrutsSpringTransactionalTestCase that merges the
> behaviour of both StrutsSpringTestCase and
> AbstractTransactionalJUnit4SpringContextTests. I currently just copy-pasted
> the relevant information from AbstractTransactionalJUnit4SpringContextTests.
> I'd like you to take a look at it and comment on whether it makes sense to
> include this in Struts. If so, feel free to use my contribution.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira