[
https://issues.apache.org/jira/browse/SUREFIRE-1546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16816459#comment-16816459
]
Stig Rohde Døssing commented on SUREFIRE-1546:
----------------------------------------------
Thanks for responding [~tibor17].
The reporter configuration idea looks good. Will there be a way to
differentiate between parameterized tests and other tests? I'm not sure how to
get reasonable behavior out of the displayname for parameterized tests
alongside regular tests.
For example, if you have a test with
{code}
@Test
@DisplayName("cool test")
void test() {}
@Test
void foo() {}
@ParameterizedTest
@ValueSource(intValue = {15, 54})
void bar(int x) {}
{code}
My preference here would be output like
{quote}
[ERROR] cool test
[ERROR] com.somepackage.TestClass.foo
[ERROR] com.somepackage.TestClass.bar[0] 15
[ERROR] com.somepackage.TestClass.bar[1] 54
{quote}
Won't I have to either choose to set PHRASED, giving me
{quote}
[ERROR] cool test
[ERROR] com.somepackage.TestClass.foo
[ERROR] com.somepackage.TestClass.[0] 15
[ERROR] com.somepackage.TestClass.[1] 54
{quote}
i.e. losing the ParameterizedTest method names, or DEFAULT
{quote}
[ERROR] com.somepackage.TestClass.test
[ERROR] com.somepackage.TestClass.foo
[ERROR] com.somepackage.TestClass.bar[0] 15
[ERROR] com.somepackage.TestClass.bar[1] 54
{quote}
i.e. losing the DisplayName?
Also I'm just saying that for parameterized tests specifically, defaulting to a
behavior where the console doesn't print the test method name for parameterized
tests is not great. I can see why the JUnit guys don't include it by default,
since it is useful to be able to leave it off in a hierarchical view in an IDE
(since e.g. having a single com.somepackage.TestClass.bar header, and then
points "[0] 15" and "[1] 54" under that header makes sense). The console output
in Surefire is flat though, and ends up lacking information about which test
method failed.
Maybe this is something I should ask about on the JUnit project? I'm not sure
how Surefire would know whether to include the parameterized test method name
or not, since users may also set a custom DisplayName, in which case the method
name shouldn't be there?
> 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)