[ 
https://issues.apache.org/jira/browse/SUREFIRE-2033?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17516168#comment-17516168
 ] 

Tibor Digana edited comment on SUREFIRE-2033 at 4/2/22 12:10 AM:
-----------------------------------------------------------------

[~roxspring]
The 
[documentation|https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html#JUnit_Runner]
 describes the POM configuration for JUnit Runner. Does it mean that JUnit5 
provider has to be activated? The user experiences is his JUnit5 tests and he 
does not necessarily can see what is under the hood. His main focus is his 
junit5/platform tests but the junit4 starter/suite is just a small tiny layer. 
He can mix junit4 and half-migrated junit5 tests with this approach of course 
but the user is moving his junit4 tests to the junit5 tests which is his target 
what he is aiming for. The documentation often describes POM configuration and 
dependencies. I believe that the user would understand the principles and he 
would better help himself.

The {{junit-platform-runner}} is JUnit4 specific. It is JUnit4 runner, so the 
{{surefire-junit4}} provider should be activated.
It means that the ProviderInfo.isApplicable() must return false for 
JUnitPlatformProviderInfo, and so the JUnit4 provider should be activated. This 
was the previous design of code and it still has the same meaning even after 
your PR which is right IMHO.

It is not worth to use {{junit-platform-runner}} if your tests are completely 
written in JUnit5 and no JUnit4 tests. Then you should delete the 
{{junit-platform-runner}} from the code, means some JUnit4 Suite class, and 
from dependencies, and you would obtain nice full version of JUnit5 tests and 
Surefire would automatically activate JUnit5 provider for you. This was my 
meaning. So that the {{junit-platform-runner}} is useful for some intermediate 
time but it should not be something long lasting in the project.


was (Author: tibor17):
[~roxspring]
The 
[documentation|https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html#JUnit_Runner]
 describes the POM configuration for JUnit Runner. Does it mean that JUnit5 
provider has to be activated? The user experiences is his JUnit5 tests and he 
does not necessarily can see what is under the hood. His main focus is his 
junit5/platform tests but the junit4 starter/suite is just a small tiny layer. 
He can mix junit4 and half-migrated junit5 tests with this approach of course 
but the user is moving his junit4 tests to the junit5 tests which is his target 
what he is aiming for. The documentation often describes POM configuration and 
dependencies. I believe that the user would understand the principles and he 
would better help himself.

The {{junit-platform-runner}} is JUnit4 specific. It is JUnit4 runner, so the 
{{surefire-junit4}} provider should be activated.
It means that the ProviderInfo.isApplicable() must return false for 
JUnitPlatformProviderInfo, and so the JUnit4 provider should be activated. This 
was the previous design of code and it still has the same meaning even after 
your PR which is right IMHO.


> Regression: 3.0.0-M5 misidentifies JUnit 5 configuration as JUnit 4
> -------------------------------------------------------------------
>
>                 Key: SUREFIRE-2033
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-2033
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: JUnit 5.x support
>    Affects Versions: 3.0.0-M5
>            Reporter: Robert James Oxspring
>            Priority: Major
>         Attachments: example.zip
>
>
> 3.0.0-M5 misidentifies a clearly JUnit 5 configuration and attempts to run 
> using JUnit 4.
> In particular the attached project only has JUnit 5 dependencies:
> {code:java}
> <dependencies>
>     <dependency>
>         <groupId>org.junit.jupiter</groupId>
>         <artifactId>junit-jupiter-engine</artifactId>
>         <version>5.6.2</version>
>         <scope>test</scope>
>     </dependency>
>     <dependency>
>         <groupId>org.junit.platform</groupId>
>         <artifactId>junit-platform-runner</artifactId>
>         <version>1.6.2</version>
>         <scope>test</scope>
>     </dependency>
> </dependencies>{code}
> and a JUnit 5 test:
> {code:java}
> package pkg;
> import org.junit.jupiter.api.Test;
> class JUnit5Test {
>     @Test
>     public void test() {
>     }
> }{code}
> When the project is run with with older version (as far back as 2.22.0) the 
> test is found and run, but 3.0.0-M5 fails to run any test:
> {code:java}
> % mvn test -Dsurefire.version=2.22.0 | tail
> [INFO] Results:
> [INFO] 
> [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
> [INFO] 
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  1.337 s
> [INFO] Finished at: 2022-03-03T09:42:27Z
> [INFO] 
> ------------------------------------------------------------------------ 
> {code}
>  
> {code:java}
> % mvn test -Dsurefire.version=3.0.0-M1 | tail
> [INFO] Results:
> [INFO] 
> [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
> [INFO] 
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  1.708 s
> [INFO] Finished at: 2022-03-03T09:34:58Z
> [INFO] 
> ------------------------------------------------------------------------ 
> % mvn test -Dsurefire.version=3.0.0-M2 | tail
> [INFO] Results:
> [INFO] 
> [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
> [INFO] 
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  1.701 s
> [INFO] Finished at: 2022-03-03T09:36:26Z
> [INFO] 
> ------------------------------------------------------------------------
> % mvn test -Dsurefire.version=3.0.0-M3 | tail
> [INFO] Results:
> [INFO] 
> [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
> [INFO] 
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  1.612 s
> [INFO] Finished at: 2022-03-03T09:37:02Z
> [INFO] 
> ------------------------------------------------------------------------
> % mvn test -Dsurefire.version=3.0.0-M4 | tail
> [INFO] Results:
> [INFO] 
> [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
> [INFO] 
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  1.619 s
> [INFO] Finished at: 2022-03-03T09:37:37Z
> [INFO] 
> ------------------------------------------------------------------------
> % mvn test -Dsurefire.version=3.0.0-M5 | tail
> [INFO] Results:
> [INFO] 
> [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
> [INFO] 
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  1.344 s
> [INFO] Finished at: 2022-03-03T09:38:01Z
> [INFO] 
> ------------------------------------------------------------------------{code}
> Note the final run above using 3.0.0-M5 and logging: {{Tests run: 0}}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to