DEV Community

Discussion on: You don't know TDD

Collapse
serhuz profile image
Sergei Munovarov

DAL/DAL/REPO layer mustn't be mocked. Why?. Simply, the objective is to test a function that works with the database.

But you could just test your DAOs/repositories with, say, in-memory DB instance in isolation. And nothing prevents you from using mocks with other application-level tests.

Collapse
stilldreaming1 profile image
still-dreaming-1 • Edited on

I would still be worried that the in memory database does not behave the same, and this would hide many bugs that would otherwise be caught by using the real database engine.

Thread Thread
jorgecc profile image
Jorge Castro

And usually, it's a common source of bugs.

For example, a classic error is if the regional setting/ collation differs from dev/final server. I regularly prefer to work agnostically (ANSI date for example) but sh*t happens.

Also, what if we are using a persistence library, for example, JPA or Entity Framework, we don't want to test its functionality but the whole experience, i.e. we don't want to test if the "insert function".