Unit tests with an external DB?

Last Update: 19.04.2018. By Jens in Developers Life | Learning | Newsletter

Today I was helping out on a second project from the stone age. It’s at least a decade old and still running and maintained. After checking out, I dared to run a mvn clean install and guess what happened?

Yep, all tests failed.

Why?

Because an external MySQL DB is required and wasn’t accessible from my machine.

Hurray.

So, basically, I can’t run any test without the external DB. Perfect for Unit testing… ok fine, I know technically it were integration tests. The funny thing is, it was testing against the DB of the integration test environment.

I am so glad that I don’t have to deal with any of such issues with a Spring Boot application. It’s so refreshing. I appropriate the power of Spring Boot even more since I know both worlds.