Fork me on GitHub

When testing functionality that interacts with a database, rather than attempt to mock any of the next.jdbc functions, I’ve been using a test-only database to verify that everything works as expected. Is this a common approach, or do you all manage tests for db-facing functionality in a different manner?


I think, as always, it depends 🙂 I do both, depending. I mock out db calls if it's trival and I'm only interested in the data, but I also hit a test database to test out things like stored procedures, or transaction checks etc...

👍 4

It's all good, so whatever works for you is good 🙂


@matt.wistrand At work we have a local test DB (Percona to match production) and we just tear it down and run all the migrations to get it up to the appropriate state for testing. For some tests, we mock out the storage functions, but for most things we just test directly against that local DB.

👍 4