Skip to content

Run the plugins' JUnit 5 unit tests (surefire discovered none) - #116

Open
opravil-jan wants to merge 1 commit into
apache:masterfrom
opravil-jan:fix/run-junit5-unit-tests
Open

opravil-jan wants to merge 1 commit into
apache:masterfrom
opravil-jan:fix/run-junit5-unit-tests

Conversation

@opravil-jan

Copy link
Copy Markdown

Problem

The plugin unit tests have not been running. Every plugin module reports:

[INFO] Using auto detected provider org.apache.maven.surefire.junit4.JUnit4Provider
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

All tests under plugins/*/src/test are JUnit 5 (Jupiter). However, plugins/pom.xml declares junit-platform-runner, which pulls JUnit 4 onto the test classpath. Surefire therefore auto-selects its JUnit 4 provider and finds none of the Jupiter tests. The build stays green in Jenkins and in the GitHub Actions PR builds.

Change

  • Remove the junit-platform-runner dependency, which nothing uses (there is no @RunWith(JUnitPlatform.class) anywhere), along with the junit.platform.version property that becomes unused. Surefire then auto-detects JUnitPlatformProvider.
  • Hamcrest was reachable only transitively through JUnit 4. Its only user, EntryEditorWidgetSorterTest, now uses assertEquals like the other test classes. The integration tests under tests/ are unaffected, since they get Hamcrest as an OSGi bundle from the target platform.

Verification

I ran mvn -f pom-first.xml install && mvn clean install on maven:3.9.16-eclipse-temurin-17. With this change, surefire runs 360 unit tests in 10 plugins, with 0 failures and 2 skipped (both @Disabled in OpenLdapAclParserTest):

plugin tests
openldap.syncrepl 77
ldapbrowser.core 52
schemaeditor 52
templateeditor 39
openldap.config.editor 34
openldap.acl.editor 30 (2 skipped)
openldap.common.ui 26
ldapbrowser.common 23
ldifparser 14
valueeditors 13

The core integration tests (tycho-surefire) give the same result as before: 82 run, 27 skipped because no external LDAP servers were available.

This makes #96 (Dependabot bump of junit-platform-runner) obsolete.

🤖 Generated with Claude Code

junit-platform-runner pulled JUnit 4 onto the test classpath, so
surefire auto-detected the JUnit4 provider and discovered none of the
Jupiter tests: every plugin module reported "Tests run: 0" and the
build stayed green. Nothing uses the runner, so drop it together with
the now unused junit.platform.version property.

Hamcrest was only reachable transitively through JUnit 4; its single
user, EntryEditorWidgetSorterTest, now asserts with JUnit's
assertEquals like the other test classes.

Surefire now runs 360 unit tests across 10 plugins (2 skipped).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant