|
|
|
|
|
by jjrumi
5570 days ago
|
|
In my case, most of the time mocks are used to avoid Database interactions: They are dangerous for writing and slow for reading. The best thing I've run into lately have been "mocking" the DB creating a copy (temporary tables with only the needed data) of the tables that the code interact with. This way you create a "mock" of the data you're going to work with and code the test getting a more reliable test in my opinion. |
|
Mocks are used to fake things that add significant overhead but no value. If you have a suite of 1000 unit tests, you really don't want half of them making actual database requests.
Simply making 'safe copies' of the database data does not solve the problem that Mocks are intended to solve.