Web Architecture, Java Ecosystem, Software Craftsmanship

H2

Don't use In-Memory Databases (like H2) for Tests

Posted on Aug 21, 2017

Don't use In-Memory Databases (like H2) for Tests

At a first glance, in-memory databases (like H2) look like a good idea. You can test your code without having to worry about installing and managing a dedicated database server up front. Just start your tests and the H2 database will be up and running. However, this comfort comes with severe drawbacks. In this post, I explain my reservations and point out alternatives.