github-plugin icon indicating copy to clipboard operation
github-plugin copied to clipboard

Migrate tests to JUnit5

Open strangelookingnerd opened this issue 11 months ago • 2 comments

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.

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

strangelookingnerd avatar Jan 23 '25 15:01 strangelookingnerd

for which there is no JUnit5 equivalent

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

KostyaSha avatar Jan 23 '25 23:01 KostyaSha

That's why junit5 was not used.

As I wrote its not available yet, but will be once https://github.com/jenkinsci/jenkins-test-harness/pull/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 avatar Jan 24 '25 08:01 strangelookingnerd

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

strangelookingnerd avatar Jul 21 '25 07:07 strangelookingnerd