Testing Dependencies with Integration Testing
Explore how to integrate testing with real infrastructure via Docker and test harnesses.
An application consists of many different components, some of which are external to it. These external components can be other services or infrastructure that must be in place for the application to function properly.
Challenges in integration testing
It is hard to find any application built for the web that does not interact with infrastructure. Actually, it’s impossible—the web server or API gateway that the application would use to receive requests would fall into the definition of infrastructure. We cannot test these dependencies using a unit test because if we replaced the dependency with any kind of test double, then it would not be a true test of that dependency. In an integration test, both components are the SUT, which means we need to test with real infrastructure when possible:
Get hands-on with 1400+ tech skills courses.