Let's move now to Gradle. As we already know, we can also use Gradle to run JUnit 5 tests. Regarding the filtering process, we can select the test to be executed based on:
- The test engine: Using the keyword engines we can include or exclude the test engine to be used (that is junit-jupiter or junit-vintage).
- The Jupiter tags: Using the keyword tags.
- The Java packages: Using the keyword packages.
- The class name patterns: Using the keyword includeClassNamePattern.
By default, all engines and tags are included in the test plan. Only the classname containing the word Tests is applied. Let's see a working example. We reuse the same tests presented in the former Maven project, but this time in a Gradle project: