Skip to content

Migrate tests to JUnit5 #2634

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
merged 2 commits into from
Feb 4, 2025
Merged

Conversation

strangelookingnerd
Copy link
Contributor

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

  • Migrate annotations
  • Migrate assertions
  • Cleanup assertions
  • Remove public visibility of test classes and methods

I did not migrate tests that explicitly test behavior of the JUnit4 rules provided by the plugin.

There are no changes to the public classes and utilities delivered by this plugin (besides https://github.com/strangelookingnerd/configuration-as-code-plugin/blob/c0e1e348f7d955560eb2219840a5cbb920245ff0/test-harness/src/main/java/io/jenkins/plugins/casc/misc/Util.java#L205-L243).

Some tests can not (yet) be migrated. Most of which use JenkinsConfiguredWithReadmeRule. While that could also be migrated to a JUnit5 Extension like JenkinsConfiguredWithCodeExtension, it seems like no other project is using that rule. Therefore I'm honestly not sure if it is worth the effort.

Your checklist for this pull request

  • 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 or in Jenkins JIRA
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Did you provide a test-case? That demonstrates feature works or fixes the issue.

@strangelookingnerd strangelookingnerd requested a review from a team as a code owner January 28, 2025 12:42
@strangelookingnerd strangelookingnerd marked this pull request as draft January 28, 2025 13:12
@strangelookingnerd
Copy link
Contributor Author

strangelookingnerd commented Jan 28, 2025

Seems like io.jenkins.plugins.casc.RoleStrategyTest.shouldReadRolesCorrectly does require #2637

strangelookingnerd and others added 2 commits February 4, 2025 12:56
* Migrate annotations
* Migrate assertions
* Cleanup assertions
* Remove public visibility of test classes and methods
@strangelookingnerd strangelookingnerd marked this pull request as ready for review February 4, 2025 12:20
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@timja timja added the test A PR that adds to testing - used by Release Drafter label Feb 4, 2025
@timja timja enabled auto-merge (squash) February 4, 2025 13:00
@timja timja merged commit c6dcdc9 into jenkinsci:master Feb 4, 2025
16 of 17 checks passed
@strangelookingnerd strangelookingnerd deleted the migrate_to_junit5 branch February 4, 2025 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test A PR that adds to testing - used by Release Drafter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants