Session

ArchUnit - Unit Testing Architecture and Design

Most projects probably have some kind of documentation of the architecture and code conventions. It's just a question of: Where? And are these documentations up to date? Does the code really adhere to these standards? In the field, documentation is all to often "write-only" and bears only faint resemblance to reality.

Wouldn't it be nice if your architectural and coding rules were checked automatically, as part of your continuous integration build? And if architecture wasn't just an occupation of some distant architect, but rather a team sport for all developers, like in an agile, cross-functional team?

With "ArchUnit" it's possible to code your architectural decisions as plain Java (or Kotlin) rules, using an easy to read fluent API. These rules can check for layered architectures, vertical slices, hexagonal (onion style) architectures, acyclic package dependencies, and for coding conventions like namings, containment of classes in packages and the use of annotations and exceptions. The rules can be checked by any unit testing framework, as for instance JUnit.

You'll see the basics of ArchUnit along with practical tips and tricks, including how to write custom rules. There will be some slides, but mostly live coding.

Thomas Much

Technical Agile Coach. Tech. People. Together.

Hamburg, Germany

View Speaker Profile