Hibernate Unit tests - Reset schema
Posted
by Marco
on Stack Overflow
See other posts from Stack Overflow
or by Marco
Published on 2010-04-26T17:40:47Z
Indexed on
2010/04/26
17:43 UTC
Read the original article
Hit count: 200
Hi, I'm testing the CRUD operations of my DAOs in JUnit tests. When i execute the single test, Hibernate always resets the schema and populates the DB in a known state. But when i execute multiple tests in a row, Hibernate resets the schema once, and then the data is accumulated during the execution of the tests.
This is an unexpected behavior, so I'd like to add in the @Before
method of the tests a function that explicitly resets the schema to avoid the pesistence of side data created by previous tests during the execution chain.
Any tips?
Thanks
© Stack Overflow or respective owner