Skip to content
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

Migrate tests to JUnit5 #387

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

strangelookingnerd
Copy link
Contributor

@strangelookingnerd strangelookingnerd commented Jan 23, 2025

This PR aims to migrate all tests to JUnit5. Changes include:

  • Migrate annotations and imports
  • Migrate assertions
  • Migrate GHMock from Rule to Extension
  • Migrate DataProviderRunner to ParameterizedTest
  • Remove public visibility for test classes and methods
  • Minor clean up

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.

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@KostyaSha
Copy link
Member

for which there is no JUnit5 equivalent

That's why junit5 was not used. What is the goal at all of doing this?

@strangelookingnerd
Copy link
Contributor Author

That's why junit5 was not used.

As I wrote its not available yet, but will be once jenkinsci/jenkins-test-harness#900 is being delivered via a newer plugin-pom version.

What is the goal at all of doing this?

In general I'd say it's a good practice to not rely on outdated libraries - even for testing. This PR removes one of these outdated libraries (com.tngtech.java:junit-dataprovider) entirely and updates another one to a more recent and therefore supported and maintained version (com.github.tomakehurst:wiremock-jre8-standalone).
Upgrading from JUnit4 to 5 not only brings some advantages in usage and features but also makes the test implementations not depend on a framework version that is no longer maintained.

* Migrate annotations and imports
* Migrate assertions
* Migrate GHMock Rule to Extension
* Migrate to DataProviderRunner to ParameterizedTest
* Remove public visibility for test classes and methods
* Minor clean up
@strangelookingnerd strangelookingnerd marked this pull request as ready for review January 27, 2025 19:52
@strangelookingnerd strangelookingnerd requested a review from a team as a code owner January 27, 2025 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants