Testing integrated components
In the previous chapter, we learned how to test components in isolation from dependencies, including other components. Isolated testing has its advantages but also has drawbacks because real dependencies are replaced with test doubles. In this section, we will learn how to test components that integrate with other components. In many scenarios, integration testing can add more value than isolated testing because we can test the code in ways that are closer to its production use. We can also add test coverage faster for components because one test can cover multiple components at once. We will use integration testing in a few examples in this section.
Using integration testing with the Vote component
In the previous chapter, we tested the Vote
component, which allowed users to click a button to increase or decrease the total likes. In this section, we will break up the implementation into separate components and write integration tests. The component...