JUnit 5 Architecture

Learn about the architecture of JUnit 5.

Introduction

The main difference between the previous versions of JUnit and JUnit 5 is the architecture.

In the previous JUnit versions, all the functions of the software were embedded into a single JAR file. This caused everyone to use the same JAR file regardless of the use case. For example, some developers may want to use JUnit to write unit tests, while others want to use it to develop build tools—both use the same JAR file. Similarly, frameworks and integrated development environments (IDEs) also used the same JAR File.

One group wanted to use the framework to write unit tests and the other wanted to support JUnit from their IDE (IntelliJ or Eclipse) or Build Tool (Maven or Gradle).

With the popularity of JUnit, almost all the famous build tools and IDEs started using JUnit.There was no separate application programming interface (API) created for them. Therefore, it created a coupling between the build tools, IDEs, and the JUnit Internals. Due to this, even a small change to JUnit’s internal API caused breaking changes in the build tools and IDEs.

One of JUnit’s developers, Johannes Link, states:

“The success of JUnit as a platform prevents the development of JUnit as a test tool .”

This was the driving point behind the architectural change of JUnit.

Get hands-on with 1400+ tech skills courses.