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

Andreas Pabst commented on SUREFIRE-2039:
-----------------------------------------

This is essentially a duplicate of SUREFIRE-2032. It was fixed in 3.0.0-M8 by 
[~gnodet].

The output is now correct:
{noformat}
[INFO] --- surefire:3.0.0-M8:test (default-cli) @ surefire-bug-poc ---
[INFO] Using auto detected provider 
org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.example.test.BTest
[WARNING] Tests run: 3, Failures: 0, Errors: 0, Skipped: 3, Time elapsed: 0.006 
s - in org.example.test.BTest
[INFO] Running org.example.test.ATest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.03 s - 
in org.example.test.ATest
[INFO]
[INFO] Results:
[INFO]
[WARNING] Tests run: 6, Failures: 0, Errors: 0, Skipped: 3
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS 
{noformat}

[~gnodet] You could close this as fixed in 3.0.0-M8. And also decline the 
corresponding pull request which is obsolete now: #493

> Skipped test classes are getting into the non-skipped test classes reports
> --------------------------------------------------------------------------
>
>                 Key: SUREFIRE-2039
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-2039
>             Project: Maven Surefire
>          Issue Type: Bug
>    Affects Versions: 3.0.0-M5
>            Reporter: Semyon Danilov
>            Priority: Major
>
> The setup: maven-surefire-plugin 3.0.0-M5 and junit 5.8.2.
> Consider a simple scenario, two test classes,  *ATest* and *BTest*, one 
> +Disabled+ and one not respectively, each has three test methods. After 
> running _mvn surefire:test_ the report will indicate that 4 tests were run 
> and one of them was skipped:
> {noformat}
> [INFO]  T E S T S
> [INFO] -------------------------------------------------------
> [INFO] Running org.example.test.BTest
> [WARNING] Tests run: 4, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 
> 0.062 s - in org.example.test.BTest
> [INFO] 
> [INFO] Results:
> [INFO] 
> [WARNING] Tests run: 4, Failures: 0, Errors: 0, Skipped: 1
> {noformat}
> And if we enable *ATest* and disable *BTest*, then the report will only 
> mention running three tests, none skipped:
> {noformat}
> [INFO]  T E S T S
> [INFO] -------------------------------------------------------
> [INFO] Running org.example.test.ATest
> [INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.079 
> s - in org.example.test.ATest
> [INFO] 
> [INFO] Results:
> [INFO] 
> [INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
> {noformat}
> This behavior is the result of the way how 
> *org.apache.maven.plugin.surefire.report.TestSetRunListener* handles skipped 
> tests. It adds them to the *detailsForThis* and only prints after the test 
> set is finished which happens when a non-disabled test set is finished thus 
> adding skipped test results to the statistics of a non-skipped test set. And, 
> of course, if the disabled test is ran after the non-disabled test, it won't 
> be reported at all.
> The reproducer can be found here: 
> https://github.com/SammyVimesFiledIssues/SUREFIRE-2039



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to