cucumber-jvm: Cucumber JUnit Platform Engine does not honour Discovery Filters
Describe the bug
If a discovery filter is set, e.g. when using Intellij JUnit Configuration with a Pattern, the Cucumber test engine ignores this filter and runs all tests regardless.
This is mostly a problem when Cucumber is used together with other engines and only a subset of tests is supposed to run.
Expected behavior
DiscoveryFilter instances, which can be retrieved through EngineDiscoveryRequest.getFiltersByType() should be evaluated.
Solution suggestion
Here’s the relevant code from the jqwik engine, which creates a predicate to use for filtering all test classes:
private static Predicate<String> buildClassNamePredicate(EngineDiscoveryRequest request) {
List<DiscoveryFilter<String>> filters = new ArrayList<>();
filters.addAll(request.getFiltersByType(ClassNameFilter.class));
filters.addAll(request.getFiltersByType(PackageNameFilter.class));
return composeFilters(filters).toPredicate();
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (11 by maintainers)
One done:
https://youtrack.jetbrains.com/issue/IDEA-276463