Junit5: Do not print summary for 'details=none' in Gradle plugin unless there are errors

Created on 22 Nov 2017  路  9Comments  路  Source: junit-team/junit5

Overview:

Can we add an option to not print out to the console? Or only print failures, similar to Gradle's Junit 4 test task?

Example DSL usage of JUnitPlatformExtension:

junitPlatform {
    filters {
        engines {
            include "spek"
        }
    }
}

Example output after tests:

> Task :kotlin:junitPlatformTest 

Test run finished after 70 ms
[         9 containers found      ]
[         0 containers skipped    ]
[         9 containers started    ]
[         0 containers aborted    ]
[         9 containers successful ]
[         0 containers failed     ]
[         4 tests found           ]
[         0 tests skipped         ]
[         4 tests started         ]
[         0 tests aborted         ]
[         4 tests successful      ]
[         0 tests failed          ]
Platform build bug

All 9 comments

I think that's a valid request.

Currently, one can set the details as follows.

--details <[none,flat,tree,verbose]>

That's used by the ConsoleLauncher which is used by the Gradle plugin behind the scenes, and the Gradle plugin defaults to details 'none'.

One could argue that none should in fact not print anything at all.

So I foresee two options:

  1. Literally display nothing when details is set to none, unless there are errors.
  2. Introduce an additional flag that displays what none currently displays when there are no errors (i.e., just the _table_ of the _counts_).

    • for example, summary

My recommendation is to do both # 1 and # 2.

@junit-team/junit-lambda, thoughts?

@sbrannen I completely agree with you analysis. none should display nothing unless there are errors, similar to the junit runner built in to Gradle already.

SGTM!

FYI: I changed the title of this issue accordingly.

I've slated this for 5.1 M2.

_in progress_

[...] and the Gradle plugin defaults to details 'none'.

What should the Gradle plugin default to? none or summary?

If we "change" the default value from none to summary the default output of the Gradle Plugin does not change. If you want the a silent/quiet mode, you have to configure it manually:

junitPlatform {
    details 'none'
    filters {
        engines {
            include "spek"
        }
    }
}

Thanks for the quick fix, @sormuras!

Was this page helpful?
0 / 5 - 0 ratings