junit-team / junit5

✅ The 5th major version of the programmer-friendly testing framework for Java and the JVM
https://junit.org
Other
6.32k stars 1.47k forks source link

The JUnit Platform does not receive complete support from IDEs and build tools #2849

Open mpkorstanje opened 2 years ago

mpkorstanje commented 2 years ago

Currently the user-guide states:

First-class support for the JUnit Platform also exists in popular IDEs (see IntelliJ IDEA, Eclipse, NetBeans, and Visual Studio Code) and build tools (see Gradle, Maven, and Ant).

However of these I know that:

do not support the use of all discovery selector primitives (either directly or indirectly) and don't fully use the hierarchal test concept (often limited to the extent needed to support JUnit 4). As such I don't believe we can claim these IDEs and build tools have first-class support for the JUnit Platform. At best I believe we may claim some support for JUnit Jupiter.

sormuras commented 2 years ago

You're right. Most support in 3rd-party tools is Jupiter-centric.

I know at least of one additional Maven plugin that tries to treat each test engine alike. ;-)

mpkorstanje commented 2 years ago

Some additional context on why I believe support for all discovery selectors is important.

A typical use case is to run a single test. For example:

mvn test -Dtest=MyExampleTest

Which is effectively the same as using a DiscoverySelectors.selectClass(MyExampleTest.class). However for the IDEs and tools listed above this is also the only supported selector.

Ideally this would be:

mvn test -Dselect-class=MyExampleTest
mvn test -Dselect-file=path/to/example.file

Currently users of Cucumber who use the junit platform are running into this problem. And as such I'm considering adding functionality in https://github.com/cucumber/cucumber-jvm/pull/2498 that makes it possible to do:

mvn test -Dcucumber.features=path/to/example.feature

but this pretty much nullifies the advantage of having the JUnit Platform create the discovery request.

mpkorstanje commented 2 years ago

You're right. Most support in 3rd-party tools is Jupiter-centric.

It's almost as if everyone ignored the "What is JUnit 5?" section of the user guide and reused the support code from JUnit 4. :rofl:

I know at least of one additional Maven plugin that tries to treat each test engine alike. ;-)

Neat!

orcunbalcilar commented 3 weeks ago

Looking forward to seeing JUnit5 first class support for Cucumber

mpkorstanje commented 3 weeks ago

@orcunbalcilar support for Cucumber from JUnit 5 is really good. Unfortunately IDEA, Gradle and Maven do not provide first class support for JUnit 5.

orcunbalcilar commented 3 weeks ago

Ah sorry, I misunderstood it. Thanks.

sbrannen commented 3 weeks ago

The use of the term "first-class" in this context refers to the fact that IDEs and build tools provide "built-in" support for the JUnit Platform based on APIs and SPIs defined by the JUnit Platform rather than support being provided by some third party or JUnit itself (like the old JUnitPlatform Runner).

Though, the support is not always "complete".

Thus, I have changed the title of this issue to reflect that.

We could also consider updating the wording in the User Guide to be a bit more transparent about the status quo.