For an introduction to TDD, Clean Architecture, and Use Case Driven Development, you can watch the following YouTube video series:
We started by covering the theoretical foundations of both TDD & Clean Architecture. In this video, the key message is that TDD is about incrementally driving development with tests coupled to behavior (not structure). We also review the evolution of “unit-testable“ architectures - starting with Hexagonal Architecture, then onion Architecture, and finally Clean Architecture. Clean Architecture exposes the behavior of a system through use cases. This meetup covers key concepts, definitions, and history. See subsequent meetups for code samples.
We introduced Use Case Driven Design and how use cases are implemented in traditional N-tier applications (CRUD), Onion Architecture and Clean Architecture. I showed some banking system use cases; see GitHub repositories - Banking Kata (Java), Banking Kata (.NET).
We went deeper into how to unit test use cases - testing both positive and negative flows. We also showed the updated Banking Kata - including the presentation layer (REST API) and infrastructure layer (with Hibernate and Entity Framework Core). We also introduced Mutation Testing.
We demonstrated the benefits of coupling tests to use cases - our tests are readable as requirements and we are free to change the internals of our system. Here we demonstrated the use of Hexagonal Architecture with unit tests coupled to use cases means that we can safely refactor the internals of our system - for example, we can move from an anemic domain to a rich domain without breaking tests.
We demonstrated effective approaches for Test Automation within Microservice Architecture, particularly through the usage of Contract Testing to ensure independent testability of Microservices. Using Hexagonal Architecture within a Microservice, we demonstrated driver adapter and driven adapter integration tests using Contract Testing. Finally, we discussed how both Contract Testing and TDD can be applied by decomposing Use Cases within a larger system.
The following are references to the code samples presented in the meetups:
These code samples are for illustrative demo purposes only just to serve as a “simple“ introduction to Clean Architecture. Real projects have more nuances than were illustrated here in these demo samples. Java and .NET were used for these samples due to widespread access to the developer community, but there may also be samples coming up in the future using other backend languages and technology stacks.
In addition to the above videos, you can view the full list of Valentina's Meetups & Podcasts: Valentina Cupać @ YouTube Playlist.