How to run integration tests at warp speed using Docker and tmpfs


As previously explained, you can run database integration tests 20 times faster! The trick is to map the data directory in memory, and my previous article showed you what changes you need to do when you have a PostgreSQL or MySQL instance on your machine.

In this post, I’m going to expand the original idea, and show you how you can achieve the same goal using Docker and tmpfs.

Continue reading “How to run integration tests at warp speed using Docker and tmpfs”

Hibernate integration testing strategies


I like Integration Testing; it’s a good way to check what SQL queries Hibernate generates behind-scenes. But Integration Tests require a running database server, and this is the first choice you have to make.

Using a production-like local database server for Integration Testing

For a production environment, I always prefer using incremental DDL scripts, since I can always know what version is deployed on a given server, and which are the newer scripts required to be deployed. I’ve been relying on Flyway to manage the schema updates for me, and I’m very content with it.

On a small project, where the amount of Integration tests is rather small, you can employ a production-like local database server for testing as well. This is the safest option since it guarantees you’re testing against a very similar environment with the production setup.

The major drawback is tests speed. Using an external database implies an additional timing cost, which may easily get out of control on a large project. After all, who’s fond about running a 60 minutes test routine on a daily basis?

Continue reading “Hibernate integration testing strategies”