Fork me on GitHub
#sql
<
2020-03-30
>
mjw16:03:32

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?

dharrigan16:03:18

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
dharrigan16:03:29

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

seancorfield17:03:00

@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