How to detect directories recursively with @Suite? #3450
Replies: 1 comment 2 replies
-
For starters,
You cannot pass any sort of hierarchy. However, you can select classes by their names, packages, and/or tags.
How do you infer their "type"? If it's based on the packages, use If it's based on their names, use If it's based on tags, use And you can of course use any combination of the aforementioned annotations. |
Beta Was this translation helpful? Give feedback.
-
Premises:
We are migrating a JUnit4 test base to JUnit5. One of the patterns that the code base have is that tests are split to directories by their type (unit/integration etc.). An advantage we get from this is that we can better monitor test status, e.g. it's easier to specify CI to ignore smoke test failure. The grouping of these test suites by type is managed by a custom JUnit4 test runner and a crawler class that outputs the list of all directories recursively.
Issue:
JUnit5 @SelectDirectory does not crawl recursively. We cannot pass our crawler's output (list of all directories) to the annotation neither because its not evaluated at compile time. Also, to our knowledge there is no interface that is synonymous to customized JUnit4 runner / JUnit5 Suite Selector without writing our own test engine.
An alternative we have is to move the crawling to build script ( maven / gradle ), but we'd prefer keeping the test specifications in the code base.
TL;DR: How to pass a hierarchy to @suite scope?
Beta Was this translation helpful? Give feedback.
All reactions