TNG / ArchUnit

A Java architecture test library, to specify and assert architecture rules in plain Java
http://archunit.org
Apache License 2.0
3.19k stars 289 forks source link

run tests with JUnit Platform #1294

Closed codecholeric closed 3 months ago

codecholeric commented 5 months ago

To pave the way to migrate to JUnit 5 we now switch the build to use the JUnit Platform runner by switching to useJUnitPlatform {..} in our Gradle build files. This doesn't effectively change much on the surface, because we still keep all JUnit 4 annotations and test infrastructure. But it now runs our JUnit 4 tests using the JUnit Vintage Engine via the Gradle JUnit Platform integration, instead of directly through the Gradle JUnit 4 integration. This effectively allows us to combine JUnit 4 and JUnit 5 tests in the same Gradle module since we can combine any number of JUnit Platform test engines. We include both JUnit Vintage and JUnit Jupiter engine, so it will pick up JUnit 4 tests as well as JUnit 5 tests. Then we can migrate tests to JUnit 5 at any pace and any granularity that we want.

codecholeric commented 5 months ago

I've compared the Gradle test xml report of all the executed tests before and after. From what I see the output coincides for both standard and slow tests (except for one wrongfully executed slow test in archunit-junit before the change, but this is then no problem but instead fixed now).