[
https://issues.apache.org/jira/browse/SUREFIRE-1546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16817279#comment-16817279
]
Stig Rohde Døssing commented on SUREFIRE-1546:
----------------------------------------------
[~tibor17] I would like the HTML report/console output to contain (at least)
the classname, method name and parameters of the test.
I'm talking about the container and its display name, because in JUnit 5,
writing a ParameterizedTest with e.g. 2 runs produces a container with a
display name (e.g. "bar(int)"), containing two tests each with their own
display names (e.g "[1] 15" and "[2] 54"). Surefire's test listener currently
only cares about the display name of the two tests, and not the name of the
container. This means we lose the test method name when using
ParameterizedTests, because we only print e.g. "[1] 15", and not "bar(int) >
[1] 15".
{quote}
IMHO what you guys have showed me is a technical problem in JUnit where the
annotation DisplayName does not show x = bar(15) and x = bar(54) which I would
expect (according the experiences with JUnit4) as a user.
{quote}
I agree that DisplayName for ParameterizedTests is slightly confusing, but the
DisplayName set for the test is for the entire set of ParameterizedTest
invocations. The DisplayName for the individual invocations is set via
ParameterizedTest(name = "invocation display name"). Does it matter whether you
need to write
{code}
@DisplayName(container = "a parameterized test (bar(int))", value = "bar({0})")
@ParameterizedTest
{code}
or
{code}
@DisplayName("a parameterized test (bar(int))")
@ParameterizedTest("bar({0})")
{code}
They express the same thing IMO.
I think the issue here is that Surefire's test listener needs to be aware that
it needs to get both the DisplayName of the invoked test method, and
potentially also the DisplayName of the containers of that test method.
{quote}
The next problem is that DisplayName talks about string constant, but JUnit5
adds something to the end: (bar(int)) which I as user would not like to see
because the framework is adding it unexpectedly and I do not have the string
under control
{quote}
JUnit 5 doesn't add anything to the DisplayName as far as I can tell? Are you
talking about the legacy reporting name?
> JUnit 5 runner does not honor JUnit 5 display names
> ---------------------------------------------------
>
> Key: SUREFIRE-1546
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1546
> Project: Maven Surefire
> Issue Type: Bug
> Components: JUnit 5.x support
> Affects Versions: 2.22.0
> Reporter: Romain Manni-Bucau
> Assignee: Tibor Digana
> Priority: Major
> Labels: junit5
> Fix For: 3.0.0-M4
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> JUnit 5 runner should respect the test @DisplayName instead of displaying the
> classname if any is defined. Seems last release doesn't support that feature
> of JUnit 5 making the console output and reports not the expected ones.
>
> Origin: https://github.com/junit-team/junit5/issues/990
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)