-
-
Notifications
You must be signed in to change notification settings - Fork 115
Migrate tests to JUnit5 #532
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
base: master
Are you sure you want to change the base?
Migrate tests to JUnit5 #532
Conversation
* Migrate annotations and imports * Migrate assertions * Remove public visibility for test classes and methods * Minor code cleanup
alecharp
left a comment
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 globally have no problem with the content of the pull request but I have a few questions:
- is it strictly required to remove the
publicfrom test methods / classes for the migration? Same for the removal ofthrowsdeclaration in method signature. - why rename some of the
JenkinsRulefromjtor?
Even if those changes are not problematic, it makes the review unnecessarily longer.
It also makes this pull request not only be about JUnit 4 to 5 migration, but about general cleanups.
|
For now, the build is not passing and I think it's related to jenkins-infra/helpdesk#4814. |
Reducing the visibility is not required, however a recommended best practice by the framework. In my opinion this brings only advantages e.g. uncovering undesirable dependencies between test classes as well as having cleaner code. In production code you would also want to reduce the visibility where possible and not declare everything Removing the
As some of the migration is still done manually I have some templates to copy & paste or search & replace. The goal is mainly consistency across the test classes.
Understandable, yet I think that by following the boy scout rule during these migrations that produce a big change set in either way I can help to improve code quality and therefore maintainability of test code. In my experience test code is oftentimes neglected when it comes to having coding standards for a project. That being said, I always try that these migrations do not only replace A with B but also improve the overall project. Adding trivial clean-ups - mostly things my IDE does recommend - is a low hanging fruit. |
| @Rule | ||
| public JenkinsSessionRule r = new JenkinsSessionRule(); | ||
| @RegisterExtension | ||
| private final JenkinsSessionExtension extension = new JenkinsSessionExtension(); |
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.
NIT: extension as a variable name is not so helpful (yes r is not either and that would probably been better as jenkinsSession) but I find extension slightly worse due to the Jenkins Extension infra so it becomes a little unclear when used.
This PR aims to migrate all tests to JUnit5. Changes include:
I am well aware that this is a quite large changeset however I hope that there is still interest in this PR and it will be reviewed.
If there are any questions, please do not hesitate to ping me.
Submitter checklist