jsedding commented on a change in pull request #50:
URL: https://github.com/apache/sling-site/pull/50#discussion_r506305711
##########
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:
These are the JUnit Platform bundles. They "serve as a foundation for
launching testing frameworks on the JVM". An arbitrary number of `TestEngine`s
can be included on the class-path (or in this case deployed to the OSGi
container). The JUnit project currently offers the JUnit Jupiter Engine and the
JUnit Vintage Engine (to support JUnit 3+4 on top of the JUnit Platform.
Deploying both allows JUnit4 and JUnit5 tests to live side-by-side, the correct
engine is selected for each test automatically.
So deploying only the JUnit Platform part is not very useful without an
engine.
Maybe a link to
https://junit.org/junit5/docs/current/user-guide/#overview-what-is-junit-5
would be helpful, it explains the architecture a bit.
----------------------------------------------------------------
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:
[email protected]