|
|
|
|
|
by spawarotti
1463 days ago
|
|
This rule is also recommended by section 9.2.4. "Only mock types that you own" of 2020 book by Vladimir Khorikov: "Unit Testing Principles, Practices, and Patterns". Worth noting is that book also says in 9.2.1: "Mocks are for integration tests only". I agree. In my opinion this book is the best comprehensive take on testing I ever encountered. |
|
as opposed to what unit tests? how are you suppose to "unit test" that you properly increment a varibale before inserting into the DB without mocking the DB? I disagree, mocks are for unit tests only. mocks allow you to isolate the unit to be tested.
integration tests is when you start integrating dependencies together. so maybe you have a dummy database like an in-memory db, but you're certainly not mocking it.
system tests is where you would use the actual db.