-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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. Note that within `archunit-integration-test` the situation is a little tricky, because we include both `archunit-junit4` and `archunit-junit5`. And those share some annotations, but with different effect. For example, `@AnalyzeClasses` alone triggers the `archunit-junit5-engine` to run a test class. If it's also annotated with `@RunWith(ArchUnitRunner.class)`, then the JUnit Vintage Engine will pick it up and run it as a JUnit 4 test. Thus, I noticed that the tests also annotated with `@RunWith(ArchUnitRunner.class)` are run twice there. Since this is an irrelevant corner case for real life scenarios, I've simply removed the `@RunWith`, because we want to run our tests with `archunit-junit5` anyway. 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). Signed-off-by: Peter Gafert <[email protected]>
- Loading branch information
1 parent
6643b9e
commit c649f41
Showing
9 changed files
with
32 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,3 @@ dependencies { | |
|
||
testRuntimeOnly project(path: ':archunit-junit5-engine') | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters