Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce exclude-method filter to complement select-method selector #3107

Closed
kishoretak opened this issue Dec 14, 2022 · 5 comments · Fixed by #3169
Closed

Introduce exclude-method filter to complement select-method selector #3107

kishoretak opened this issue Dec 14, 2022 · 5 comments · Fixed by #3169

Comments

@kishoretak
Copy link

Support for exclude-method similar to exclude-class filter or select-method selector

Surefire provides exclude-method support by adding "!" to includes (config) or -Dtest (command line args), similarly, there should be support for the same in console-launcher as well.

https://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html

@sbrannen sbrannen changed the title Support for exclude-method filter Introduce exclude-method filter to complement select-method selector Dec 14, 2022
@marcphilipp
Copy link
Member

We discussed this in the team and think we could add a --exclude-methodname option to the ConsoleLauncher that would be implemented as a PostDiscoveryFilter and match the specified regex against the fully-qualified method name without parameters.

For example, --exclude-methodname=.+#methodName would exclude all methods called methodName from all classes.

@kishoretak
Copy link
Author

Thanks @marcphilipp, any rough timeline for this feature?

@sbrannen
Copy link
Member

@kishoretak, we have not scheduled this feature for any upcoming milestone.

As you can see from the assigned labels, we put this in the status: waiting-for-interest category.

However, I just added the up-for-grabs label to indicate that we would accept a contribution from the community.

@yhkuo41
Copy link
Contributor

yhkuo41 commented Feb 8, 2023

May I give it a try? Do I need to deliver the following items like issue 313?

  • Introduce include and exclude filter support for methods in a new MethodFilter class (similar to ClassFilter).
  • Introduce include and exclude filter support for methods in the Gradle JUnit Platform plugin.
  • Introduce include and exclude filter support for methods in the JUnitPlatform runner (e.g., @IncludeMethods and @ExcludeMethods).

yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Feb 8, 2023
@sbrannen
Copy link
Member

sbrannen commented Feb 9, 2023

@Sakieye,

Thanks for volunteering. Since it's up-for-grabs, anyone is welcome to submit a PR.

Please note, however, that issue #313 is very old. The Gradle JUnit Platform plugin no longer exists, and the JUnitPlatform runner for JUnit 4 is deprecated.

Rather (at a quick glance) the focus would be on a MethodFilter (as you mentioned) and the ConsoleLauncher.

yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Feb 24, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Feb 25, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Feb 25, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Feb 25, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Feb 25, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Feb 25, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Feb 25, 2023
@sbrannen sbrannen linked a pull request Feb 26, 2023 that will close this issue
7 tasks
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Mar 7, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Apr 19, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Apr 19, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Apr 19, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Apr 19, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Apr 19, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Apr 19, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue May 21, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue May 28, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Jul 26, 2023
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Sep 23, 2024
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Oct 16, 2024
yhkuo41 added a commit to yhkuo41/junit5 that referenced this issue Oct 16, 2024
marcphilipp pushed a commit that referenced this issue Oct 16, 2024
The new `--exclude-methodname` and `--include-methodname` options added
of the `ConsoleLauncher` allow include or exclude methods based on fully
qualified method names without parameters. For example,
`--exclude-methodname=^org\.example\..+#methodname` will exclude all
methods called `methodName` in the `org.example` package or any of its
subpackages.

Resolves #3107.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants