3 ms·
I like this design and dislike mock-heavy tests. However, doesn't it have similar issues to mock-heavy tests? The database actions are equivalent to the mocked-
by skybrian 10y ago
I like this design and dislike mock-heavy tests. However, doesn't it have similar issues to mock-heavy tests? The database actions are equivalent to the mocked-out method calls in an imperative design. Your tests can pass and the application can still fail when the database doesn't behave the way you think it should.
You can separately test the code that accesses the database, but maybe it's not as complete as it should be, just like in the layered architecture.
Fundamentally, we still have a layered architecture, with the connections between layers represented differently.
- lotyrin 10y agoThe difference between expect my_func to call thing.method and expect my_func to return a call_thing_method Might not seem like much except that the implementation of indirection is one that is in place during production and whole-system tests - a genuine article - and not one that is only in place during unit testing. An indirection that behaves contrary to how it's expected to but is used in production or whole-system testing can be found, a faulty indirection that exists only during a particular unit test goes unnoticed