Results 1 to 2 of 2

Thread: Is Spring TransactionalJUnitTests actually integration test?

  1. #1
    Join Date
    Nov 2010
    Posts
    6

    Default 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. #2
    Join Date
    Jul 2010
    Location
    Venice, Italy
    Posts
    709

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •