-
Notifications
You must be signed in to change notification settings - Fork 47
Generate DisplayName annotation only for JUnit 5 #576 #624
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
Conversation
testFrameworkManager.addTestDescription(displayName) | ||
} | ||
else -> { | ||
// nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to create a ticket to add a custom Java tag for display name as @DisplayName or @summary for JUnit 4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's weird that we just forget the generated display name :( for JUnit4 but generates it.
No logging in this file at all, it's sad too
/* JUnit4 doesn't have DisplayName annotation and any other suitable for putting short description, | ||
that's why we add a single line comment below JavaDoc with a test's short description. | ||
*/ | ||
if (testFramework is Junit4 && displayName != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we don't need this short commented summary under the test, it looks weird and clashes with the JavaDocs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that single-line comment below JavaDoc might look weird, but it contains short useful information about the test. As you suggested in another comment, we can add a custom JavaDoc tag for it in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, that the comment line does not look good. I am even not sure, that an average user will understand what it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed as discussed, now we don't show display name in case of JUnit4.
Description
Add a single line comment with a short description for JUnit4.
Generate
@DisplayName
annotation only for JUnit5.Add a value for
description
argument for TestNG.Fixes #576
Screenshots for JUnit4, JUnit5, and TestNG respectively:



UPDATE: decided to not show a display name in case of JUnit4 and to not add a single line comment.
Type of Change
How Has This Been Tested?
Automated Testing
Run summary tests.
Manual Scenario
Generate tests using different test frameworks: JUnit4, JUnit5, TestNG and check test annotations and comments.
Checklist (remove irrelevant options):