Testing main paths with system tests
At the top of the pyramid are what I call system tests. A system test starts up the whole application and runs requests against its API, verifying that all our layers work in concert.
Hexagonal Architecture is all about creating a well-defined boundary between our application and the outside world. Doing so makes our application boundaries very testable by design. To test our application locally, we just need to swap out the adapters with mock adapters, as outlined in Figure 8.2.
Figure 8.2 – By replacing the adapters with mocks, we can run and test our application without dependencies on the outside world
On the left, we can replace the input adapters with a test driver that calls the application’s input ports to interact with it. The test driver can implement certain test scenarios that simulate user behavior during an automated test.
On the right, we can replace the output adapters with mock adapters...