Skip to content

Conversation

@strangelookingnerd
Copy link
Contributor

@strangelookingnerd strangelookingnerd commented Jan 23, 2025

This PR aims to migrate all tests to JUnit Jupiter. 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
  • Ban JUnit4 imports

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.

@strangelookingnerd strangelookingnerd force-pushed the migrate_to_junit5 branch 2 times, most recently from 84830a1 to b447f83 Compare January 24, 2025 08:33
@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
* 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
Copy link
Contributor Author

@jenkinsci/github-plugin-developers Kindly requesting a review.

# Conflicts:
#	src/test/java/com/cloudbees/jenkins/GlobalConfigSubmitTest.java
@strangelookingnerd strangelookingnerd changed the title Migrate tests to JUnit5 Migrate tests to JUnit Jupiter Nov 14, 2025
* Migrate annotations and imports
* Migrate assertions
* Remove public visibility for test classes and methods
* Minor code cleanup
* Ban JUnit4 imports
@KostyaSha
Copy link
Member

just merge it?

@strangelookingnerd
Copy link
Contributor Author

just merge it?

No objections from my end. Since tests pass, coverage is the same and no other check is failing it's pretty safe to assume the migration is successful. I will anyway stick around and am happy to take care of any issues that may result out of merging.

@KostyaSha KostyaSha merged commit 4127935 into jenkinsci:master Nov 17, 2025
17 checks passed
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