question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cucumber JUnit Platform Engine does not honour Discovery Filters

See original GitHub issue

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();
	}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
mpkorstanjecommented, Aug 20, 2021
0reactions
mpkorstanjecommented, Aug 10, 2021

You request what you need, and I’ll request what I’ll need. I’m sure we can fit more then one link in a tweet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature files discovery in cucumber-junit-platform-engine
After migrating to cucumber-junit-platform-engine @CucumberOptions are no longer supported. package com.mycompany.cucumber; import io.cucumber.
Read more >
Support cucumber-junit-platform-engine : IDEA-227508
This happens because IDEA creates an "All tests in package test" which will issue a discovery selector for the class path root with...
Read more >
[JVM] Using JUnit categories to control Cucumber tests
I'm having trouble using JUnit categories to control which Cucumber scenarios get executed. I created a JUnit category called ...
Read more >
A-Index (JUnit 5.9.1 API)
Return a filter that will include elements if and only if the adapted Filter includes the ... Method in class org.junit.platform.engine.support.discovery.
Read more >
Cucumber with JUnit 5 - cronn GmbH
Thanks to Gradle integrating Cucumber with JUnit 5 is easy. ... platform-engine to work with the junit-platform-suite to discover feature ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found