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

Tibor Digana edited comment on SUREFIRE-1546 at 4/14/19 5:06 PM:
-----------------------------------------------------------------

[~Srdo]
Don't talk about Surefire because latest version does not understand 
DisplayName.
What is obious from your code and listener console is the fact that DisplayName 
annotation has *bar({0})* but the console has *displayName: a parameterized 
test (bar(int)), type: TEST, source: MethodSource*.
Now me as developer of Surefire should must be interested in the following call:

{code:java}
Optional<TestSource> testSource = testIdentifier.getSource();
String display = testIdentifier.getDisplayName(); // <<<------------
MethodSource methodSource = testSource.map( MethodSource.class::cast ).get();
// we are in the test method "bar"
String methodName = methodSource.getMethodName(); // returns "bar"
{code}

and I expect that {{display}} would have the string from the DisplayName 
annotation, i.e. {{bar(15)}} etc.

I guess the user would expect the same. And if it is not like that then it is a 
problem, and even more problematic if another "display name" is in the second 
annotation {{ParameterizedTest}}.
How should I as Surefire developer cope with the JUnit API in this case of 
parameterized tests?


was (Author: tibor17):
[~Srdo]
Don't talk about Surefire because latest version does not understand 
DisplayName.
What is obious from your code and listener console is the fact that DisplayName 
annotation has {{bar({0})}} but the console has {{displayName: a parameterized 
test (bar(int)), type: TEST, source: MethodSource}}.
Now me as developer of Surefire should must be interested in the following call:

{code:java}
Optional<TestSource> testSource = testIdentifier.getSource();
String display = testIdentifier.getDisplayName(); // <<<------------
MethodSource methodSource = testSource.map( MethodSource.class::cast ).get();
// we are in the test method "bar"
String methodName = methodSource.getMethodName(); // returns "bar"
{code}

and I expect that {{display}} would have the string from the DisplayName 
annotation, i.e. {{bar(15)}} etc.

I guess the user would expect the same. And if it is not like that then it is a 
problem, and even more problematic if another "display name" is in the second 
annotation {{ParameterizedTest}}.
How should I as Surefire developer cope with the JUnit API in this case of 
parameterized tests?

> 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)

Reply via email to