Skip to content

DisplayName with Test feature idea #1577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rafalschmidt97 opened this issue Sep 5, 2018 · 4 comments
Closed

DisplayName with Test feature idea #1577

rafalschmidt97 opened this issue Sep 5, 2018 · 4 comments

Comments

@rafalschmidt97
Copy link

rafalschmidt97 commented Sep 5, 2018

Overview

Hi, junit5 is a great piece of software. Today I realized while testing that a lot of time doing unit testing the @DisplayName is almost the same as a name of method. I mean there are many schools how the name of method should look like, but for example, let's take a look at this one below:

methodName_StateUnderTest_ExpectedBehavior

And here is my idea - create a flag, for example Test(xxx=true) or Test(xxx="_") or DisplayName(xxx="_") which will use the name of method. The final result may look like this:

parse_WithEmptyString_ThrowIllegalArgumentException
will be converted to
parse with empty string throw illegal argument exception

Let me know what you think.

@mkobit
Copy link
Contributor

mkobit commented Sep 5, 2018

Does #162 address this use case?

@rafalschmidt97
Copy link
Author

rafalschmidt97 commented Sep 5, 2018

@mkobit it is almost the same problem.

I would love to see splitting with underscore also.

@sbrannen
Copy link
Member

sbrannen commented Sep 5, 2018

I am closing this issue as a duplicate of #162.

#162 would introduce support for achieving this in the form of an extension, likely with a default implementation that "prettifies" based on either camel-casing or underscores (or potentially both).

If you would specifically like support for splitting on underscores, please voice your opinion in #162.

Thanks

@sbrannen
Copy link
Member

sbrannen commented Sep 5, 2018

Also, just FYI... the @Test annotation will likely never support any attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants