re: You don't know TDD VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Let's say we are building a simple CRUDL (like 99% of the business project). DAL/DAL/REPO layer mustn't be mocked. Why?. Simply, the objective i...
 

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.

 

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.

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".

code of conduct - report abuse