Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
onewhl merged 2 commits into main from onewhl/576-bug-display-name-annotation
Aug 3, 2022

Conversation

Copy link
Member

@onewhl onewhl commented Aug 1, 2022
edited
Loading

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:
junit4
junit5
testng

UPDATE: decided to not show a display name in case of JUnit4 and to not add a single line comment.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

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

  • The change followed the style guidelines of the UTBot project
  • Self-review of the code is passed
  • The change contains enough commentaries, particularly in hard-to-understand areas
  • New documentation is provided or existed one is altered
  • No new warnings
  • New tests have been added
  • All tests pass locally with my changes

@onewhl onewhl added the comp-summaries Something related to the method names, code comments and display names generation label Aug 1, 2022
testFrameworkManager.addTestDescription(displayName)
}
else -> {
// nothing
Copy link
Collaborator

@amandelpie amandelpie Aug 1, 2022

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

onewhl reacted with thumbs up emoji
Copy link
Collaborator

@amandelpie amandelpie Aug 1, 2022

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) {
Copy link
Collaborator

@amandelpie amandelpie Aug 1, 2022

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

alisevych reacted with thumbs up emoji
Copy link
Member Author

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.

Copy link
Collaborator

@denis-fokin denis-fokin Aug 2, 2022

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.

Copy link
Member Author

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.

@onewhl onewhl merged commit 45e687e into main Aug 3, 2022
@onewhl onewhl deleted the onewhl/576-bug-display-name-annotation branch August 3, 2022 09:49
tamarinvs19 pushed a commit that referenced this pull request Aug 4, 2022
* Generate DisplayName annotation only for JUnit 5 #576
* Review fixes
denis-fokin pushed a commit that referenced this pull request Aug 18, 2022
* Generate DisplayName annotation only for JUnit 5 #576
* Review fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@denis-fokin denis-fokin denis-fokin approved these changes

@amandelpie amandelpie amandelpie approved these changes

Assignees
No one assigned
Labels
comp-summaries Something related to the method names, code comments and display names generation
Projects
Archived in project
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Generated tests contain JUnit4 @Test and commented JUnit5 @DisplayName annotations

AltStyle によって変換されたページ (->オリジナル) /