S01E18: [TDD 🍅 15] Unit vs Integration Tests - Testing a Concrete Factory Implementation in Swift

In this episode, we start test-driving a concrete implementation of the ViewControllerFactory protocol.

As we dive into the first tests, we decide it’s important to isolate the factory tests as much as we can in order to avoid fragile tests that rely too much on poking the UI.

To do so, we showcase two approaches and discuss their drawbacks. One is to make the view controller’s properties getters internal, enabling the test target to assert its values in a unit test style, and the other is to have integration tests that combine multiple layers in its setup.

Finally, we decide to go with unit tests and internal getters, as it’s simpler and much easier to manage when dealing with multiple deployment targets.

Subscribe now to our Youtube channel and catch free new episodes every week and follow along the project's progress on GitHub.