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 #389

Merged
merged 3 commits into from
Mar 10, 2025

Conversation

strangelookingnerd
Copy link
Contributor

@strangelookingnerd strangelookingnerd commented Jan 27, 2025

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

  • Migrate annotations and imports
  • Migrate assertions
  • Remove public visibility for test classes and methods
  • Minor clean up

Some tests fail due to jenkinsci/jenkins-test-harness#901 which will likely be fixed in plugin-pom 5.7. I'll update the PR once it is available.

Some tests fail due to jenkinsci/configuration-as-code-plugin#2637 which will likely be fixed in an upcoming release of configuration-as-code-plugin via bom. I'll update the PR once it is available.

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

@strangelookingnerd strangelookingnerd requested a review from a team as a code owner January 27, 2025 08:44
@strangelookingnerd strangelookingnerd marked this pull request as draft January 27, 2025 08:44
* Migrate annotations and imports
* Migrate assertions
* Remove public visibility for test classes and methods
* Minor clean up
@strangelookingnerd strangelookingnerd marked this pull request as ready for review March 5, 2025 12:10
@@ -114,13 +118,13 @@ private static void testCycle(String macroName, Integer macroId, String[] parame
}

private static void assertEquals(Macro expected, Macro actual) {
Assert.assertEquals("Wrong name", expected.getName(), expected.getName());
Assert.assertEquals("Wrong index", expected.getIndex(), expected.getIndex());
Assertions.assertEquals(expected.getName(), actual.getName(), "Wrong name");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we statically import the assertEquals and use it like that in this file. Then we're in sync with all other files how to import the Assertions

Copy link
Contributor Author

@strangelookingnerd strangelookingnerd Mar 10, 2025

Choose a reason for hiding this comment

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

We can't since it would ambiguous with the surrounding method MacroTest#assertEquals(Macro, Macro)

Copy link
Contributor

Choose a reason for hiding this comment

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

a right

@mawinter69 mawinter69 merged commit 6da0d46 into jenkinsci:master Mar 10, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants