3 ms·
> Unit tests should be small, specific enough tests that they should not ever require using the database. > I don’t know if it’s laziness, IDGAF, ignorance, stu
by patrec 5y ago
> Unit tests should be small, specific enough tests that they should not ever require using the database.
> I don’t know if it’s laziness, IDGAF, ignorance, stubbornness, [...]
My impression is that most people who think along these lines just lack the technical ability to make tests that involve the database fast (or maybe even robust), or just parrot something they heard. If you want to test a service that requires DB access for most things it does as part of its core logic, why either exclusively rely on more difficult to debug end-to-end tests, or put in extra effort and bloat for worse tests with nonsense like mocking when you can just give it a database in a way that adds basically no discernible overhead to your test run?