Dependency Injection: Turtles all the way down?

后端 未结 5 862
执笔经年
执笔经年 2020-12-01 18:11

So I\'m wondering about how unit testing works in regards to dealing external dependencies. Here and elsewhere I\'ve become familiar with dependency injection, and how that

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-01 19:08

    Keep in mind the difference between unit testing and integration testing. In the former, the dependency would be mocked whereby it provides expected behavior for the purpose of testing the class which consumes the dependency. In the latter, an actual instance of the dependency is initialized to see if the whole thing works end-to-end.

提交回复
热议问题