Tips for Testing Database Code

Almost everybody understands that source code belongs into version control. Many people understand we need to test our code. Quite a few do that automatically. But everything seems to change when it comes to databases. A lot of stuff in and around databases goes untested. Heck some of the scripts don’t even live in version [...]

Testing Databases with JUnit and Hibernate Part 3: Cleaning up and Further Ideas

This is the last part in this little series about testing of database code. In the first part I extracted the session handling for the tests into a JUnit Rule. In the second part I introduced ObjectMothers for easy creation of instances in the database. In this part I’ll simplify the implementation of new ObjectMothers [...]

Testing Databases with JUnit and Hibernate Part 2: The Mother of All Things

In the first part of this little series I showed a simple test based on a simple data model. As we saw the code for the test wasn’t simple at all, but quite ugly. We started to fix that by moving out all the SessionFactory and Session handling stuff out into a Rule. Leaving us [...]