kwin commented on a change in pull request #50: URL: https://github.com/apache/sling-site/pull/50#discussion_r506220485
########## File path: src/main/jbake/content/documentation/bundles/org-apache-sling-junit-bundles.md ########## @@ -27,6 +27,42 @@ the test class names, like for example: Sling-Test-Regexp=com.example.*ServerSideTest +### JUnit 4 Support +All that is required is the installation of the the Apache Sling JUnit Core bundle. The bundle exports the packages `junit.*`, `org.junit.*` and additionally `org.hamcrest.*`. Note however that the `org.junit.platform.*` packages, which contain the generic testing platform developed for JUnit 5, are NOT exported. + +### JUnit 5 Support (since version 2.0.0) Review comment: version 1.1.0? ########## File path: src/main/jbake/content/documentation/bundles/org-apache-sling-junit-bundles.md ########## @@ -27,6 +27,42 @@ the test class names, like for example: Sling-Test-Regexp=com.example.*ServerSideTest +### JUnit 4 Support +All that is required is the installation of the the Apache Sling JUnit Core bundle. The bundle exports the packages `junit.*`, `org.junit.*` and additionally `org.hamcrest.*`. Note however that the `org.junit.platform.*` packages, which contain the generic testing platform developed for JUnit 5, are NOT exported. + +### JUnit 5 Support (since version 2.0.0) +JUnit 5 support requires installation of a number of bundles provided by the JUnit team. The Apache Sling JUnit Core bundle has optional imports for some of the packages exported by these bundles and will automatically switch to JUnit 5 support if these are available (a bundle restart is required). + +To satisfy the imports of the Apache Sling JUnit Core bundle, four additional bundles need to be installed: + +- org.opentest4j:opentest4j +- org.junit.platform:junit-platform-commons +- org.junit.platform:junit-platform-engine +- org.junit.platform:junit-platform-launcher + +<div class="note"> +Note: `junit-platform-commons` version 1.7.0 cannot be deployed using Sling's OSGi Installer, due to [junit5 issue #2438](https://github.com/junit-team/junit5/issues/2438). Other JUnit5 bundles _may_ be affected by the same issue. +</div> + +However, this is not yet very useful. In order to run tests, at least one implementation of `org.junit.platform.engine.TestEngine` needs to be available. `TestEngine` implementations are advertised using Java's `ServiceLoader` mechanism. Apache Sling Junit Core takes care of detecting test engines in other installed bundles and automatically makes them available for test execution. Review comment: > However, this is not yet very useful. It is not clear to me to what this refers. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org