Databases · Middle · Question 64 of 75

Why are integration tests against a real database (e.g. in Docker) often preferred over mocking the database?

Explanation

Run each test in a transaction that rolls back, or reset the schema, so tests stay isolated. Testcontainers makes this convenient.

Further reading

Problem with a question

Databases · Middle · question 64

Test yourself

Take the Databases · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz