Testing

Section • 4 episodes • 2 hr 42 min

An architecture is only as strong as its testability, and the Composable Architecture is incredibly testable. We are able to unit test every part of the architecture, include the core types that features are built with, the side effects that interact with the outside world, and the runtime that glues everything together to actually power the application.

Related content

The Composable Architecture also unlocks some incredible ways to perform snapshot testing in SwiftUI. We are able to use the Store to play a series of user actions, and then take snapshots of the UI at each step of the way. This gives us lightweight integration testing of our UI with very little work that rivals the tools that Xcode gives us out of the box.

SwiftUI Snapshot Testing
34 min

In this section we used the “environment” technique for controlling dependencies that we first covered in the early days of Point-Free. It eschews using protocols for dependencies and just uses simple structs, which gives us a lot of flexibility.

Dependency Injection Made Easy
35 min
Dependency Injection Made Comfortable
28 min

Although the “environment” technique of dependency injection is powerful, and can help you get test coverage in an application almost immediately, we can make it even better in the Composable Architecture. By baking the notion of an environment directly into the core types of the architecture we will make our dependencies more controllable and more understandable, all without sacrificing composability.

Dependency Injection Made Composable
32 min
Dependency Injection Made Modular
34 min
Modular Dependency Injection: The Point
44 min

Where to go from here

The Composable Architecture is now quite robust and handles many things that are important to real life applications, such as composition, modularity, side-effects and testing. With this foundation set we can now look for ways to take the architecture to the next level.