Conclusion: Testing Architecture Elements

Let's recap how testing architecture elements can help us build maintainable software.

How does this help me build maintainable software?

The Hexagonal Architecture style cleanly separates between domain logic and outward-facing adapters. This helps us define a clear testing strategy that covers the central domain logic with unit tests and the adapters with integration tests.

The input and output ports provide very visible mocking points in tests. For each port, we can decide to mock it or to use the real implementation. If the ports are each very small and focused, mocking them is a breeze instead of a chore. The less methods a port interface provides, the less confusion there is about which of the methods we have to mock in a test.

Get hands-on with 1400+ tech skills courses.