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