bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://github.com/bazelbuild/intellij/blob/master/docs/index.md
Apache License 2.0
763 stars 308 forks source link

Simplify --test_filter values for JUnit5 #7061

Open joca-bt opened 2 hours ago

joca-bt commented 2 hours ago

Description of the feature request:

When filtering tests for JUnit5, the plugin is generating filter expressions that look like:

mypackage.myClass#
mypackage.myClass#myMethod$
mypackage.myClass1#(myMethod1|myMethod2)$|mypackage.myClass2#myMethod$

The trailing # and $ were a recent change. While $ may be useful in JUnit3 to determine where a "class boundary" ends, as the plugin is using , for enumeration in that case (i.e. mypackage.myClass1#myMethod1,myMethod2$), it is not needed when the enumeration is between () as in JUnit5.

It should be possible to simplify the filter expressions to something like:

mypackage.myClass
mypackage.myClass#myMethod
mypackage.myClass1#(myMethod1|myMethod2)|mypackage.myClass2#myMethod

While a minor change, this is more closely related with JUnit's selector "language", as these will convert to:

--select-class=mypackage.myClass
--select-method=mypackage.myClass#myMethod
--select-method=mypackage.myClass1#myMethod1 --select-method=mypackage.myClass1#myMethod2 --select-method=mypackage.myClass2#myMethod

and they require less postprocessing in the test runners.

This will also free $ to be used with nested classes. Currently, expressions with nested classes look like:

mypackage.myClass.myNestedClass

which forces test runners to have to determine if a given class is nested or not.

Which category does this issue belong to?

Intellij

What underlying problem are you trying to solve with this feature?

No response

What operating system, Intellij IDE and programming languages are you using? Please provide specific versions.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

joca-bt commented 2 hours ago

@tpasternak regarding https://github.com/bazelbuild/intellij/pull/7060, I'd like to discuss the changes proposed here.