archetypes icon indicating copy to clipboard operation
archetypes copied to clipboard

Upgrade tests to use JUnit5

Open strangelookingnerd opened this issue 1 year ago • 1 comments

It should be considered best practice to start plugin development using JUnit5 over JUnit4.

  • org.junit.* imports being updated to JUnit5 equivalents
  • Use @WithJenkins in combination with JenkinsRule
  • Make test classes and methods package-private (convention for JUnit5)

I'm not 100% convinced that I migrated SampleConfigurationTest correctly since I was not able to find a proper equivalent for JenkinsSessionRule - maybe @basil could confirm if the test still covers the intended functionality.

Testing done

Ran mvn clean verify without errors.

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

strangelookingnerd avatar Jan 12 '24 10:01 strangelookingnerd

@basil Thanks for checking. I will look into it and try to find a proper solution. I was a little put off by the assertion stating "still there after restart of Jenkins" but now I know what’s supposed to happen.

strangelookingnerd avatar Jan 12 '24 19:01 strangelookingnerd