Why is it problematic to use a database in tests?


I watch this video stream (Jon Galloway and Jesse Liberty) about creating a repository for testing, and they mentioned that this is not a good idea. have a database, and rather you should use a fake repository. Two reasons they gave for this:
1. The database may not be available, and
2. Unit tests should be focused at the code level.

So, about the first, I never came across a scenario where I wanted to work on anything and test env. The database is unavailable, and the second moment they did, I did not receive.

So is this a bad practice using your database in unit tests? What is the potential harm?

Thank.

+3
source share
2

. (.. ).

, - , , .

a unit test , ().

@Darin, , , , .

+3

, ?

, . , . , , unit test.

, (, ), . . . , , , , , .

( ORM) - (, SQLite), .

+5

All Articles