Announcement Announcement Module
Collapse
No announcement yet.
Is Spring TransactionalJUnitTests actually integration test? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is Spring TransactionalJUnitTests actually integration test?

    Hello everyone,

    I am not sure if this is right place i post my question. I have a question about spring junit framework (extends AbstractTransactionalJUnit4SpringContextTests). is this test framework a integration test framework? because i just found that it can inject DAO and interact with Database. Thanks.

  • #2
    It is support for Junit 4, so to do UNIT testing and not integration testing. If the unit you are testing is a DAO (a data access object, which DOES interact with the db - in fact it should do NOTHING else) you want to test its operations without real inpact on the db. Transactional tests let you simulate your operations in a transaction to test them against SQLExceptions and other DAO - related problems but be able to roll back at the end (even if the test is successful) so that the DB is not influenced by the tests.

    It is a very valuable instrument to fully unit-test your persistence layer components without having to get a DB (even a test DB) dirty. If you are curious, you can learn how to use it in the official reference documentation.

    Comment

    Working...
    X