You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by GitBox <gi...@apache.org> on 2020/10/07 14:18:27 UTC

[GitHub] [sling-site] jsedding opened a new pull request #50: SLING-9795 - JUnit 5 support for server-side tests

jsedding opened a new pull request #50:
URL: https://github.com/apache/sling-site/pull/50


   - documentation update


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [sling-site] kwin commented on a change in pull request #50: SLING-9795 - JUnit 5 support for server-side tests

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



[GitHub] [sling-site] jsedding commented on a change in pull request #50: SLING-9795 - JUnit 5 support for server-side tests

Posted by GitBox <gi...@apache.org>.
jsedding commented on a change in pull request #50:
URL: https://github.com/apache/sling-site/pull/50#discussion_r506325944



##########
File path: src/main/jbake/content/documentation/bundles/org-apache-sling-junit-bundles.md
##########
@@ -11,7 +11,7 @@ provide different examples including HTTP-based and server-side teleported tests
 bundle module, running against a full Sling instance setup in the same Maven module.
 
 ## org.apache.sling.junit.core: server-side JUnit tests support
-This bundle provides a `JUnitServlet` that runs JUnit tests found in bundles. 
+This bundle provides a `JUnitServlet` that runs JUnit tests found in bundles. Both JUnit 4 tests and (optionally) JUnit 5 tests (aka Jupiter) are supported.

Review comment:
       In the JUnit 5 documentation they use the spaced spelling for both JUnit 4 and JUnit 5. That's why I chose it. Also I tried to be consistent within this document, I hope I've achieved that :)




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [sling-site] bdelacretaz commented on a change in pull request #50: SLING-9795 - JUnit 5 support for server-side tests

Posted by GitBox <gi...@apache.org>.
bdelacretaz commented on a change in pull request #50:
URL: https://github.com/apache/sling-site/pull/50#discussion_r506310273



##########
File path: src/main/jbake/content/documentation/bundles/org-apache-sling-junit-bundles.md
##########
@@ -11,7 +11,7 @@ provide different examples including HTTP-based and server-side teleported tests
 bundle module, running against a full Sling instance setup in the same Maven module.
 
 ## org.apache.sling.junit.core: server-side JUnit tests support
-This bundle provides a `JUnitServlet` that runs JUnit tests found in bundles. 
+This bundle provides a `JUnitServlet` that runs JUnit tests found in bundles. Both JUnit 4 tests and (optionally) JUnit 5 tests (aka Jupiter) are supported.

Review comment:
       Not sure if the spelling should by "Junit4" or "Junit 4" with a space.
   
   The former returns 4x more results on google.com and has my preference in terms of searching for these things.
   
   No big deal - feel free to use whatever works for you!




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [sling-site] jsedding merged pull request #50: SLING-9795 - JUnit 5 support for server-side tests

Posted by GitBox <gi...@apache.org>.
jsedding merged pull request #50:
URL: https://github.com/apache/sling-site/pull/50


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [sling-site] jsedding commented on a change in pull request #50: SLING-9795 - JUnit 5 support for server-side tests

Posted by GitBox <gi...@apache.org>.
jsedding commented on a change in pull request #50:
URL: https://github.com/apache/sling-site/pull/50#discussion_r506328700



##########
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 1.1.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).

Review comment:
       I'm currently rewording the JUnit 5 Support section. I agree the wording is confusing here, so I'll try to improve it.
   
   To clarify: once the bundle switches to JUnit 5 support, it runs tests using the JUnit Platform. This allows running JUnit 5 tests  using the JUnit Jupiter engine and JUnit 3+4 tests using the JUnit Vintage engine. And if both engines are available, both test styles are supported side-by-side.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [sling-site] kwin commented on a change in pull request #50: SLING-9795 - JUnit 5 support for server-side tests

Posted by GitBox <gi...@apache.org>.
kwin commented on a change in pull request #50:
URL: https://github.com/apache/sling-site/pull/50#discussion_r506224614



##########
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.
+
+The most commonly used test engines are the "JUnit Jupiter Engine" for JUnit5 support and the "JUnit Vintage Engine", a backwards compatibility layer to allow running JUnit 4 tests on the new JUnit Platform.
+
+#### Bundles for the JUnit Jupiter Engine (JUnit 5)
+
+- org.junit.jupiter:junit-jupiter-api

Review comment:
       In addition to the ones from above or instead?




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [sling-site] jsedding commented on pull request #50: SLING-9795 - JUnit 5 support for server-side tests

Posted by GitBox <gi...@apache.org>.
jsedding commented on pull request #50:
URL: https://github.com/apache/sling-site/pull/50#issuecomment-713459393


   Thanks @kwin for reviewing again. I have merged this now.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [sling-site] jsedding commented on a change in pull request #50: SLING-9795 - JUnit 5 support for server-side tests

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



[GitHub] [sling-site] bdelacretaz commented on a change in pull request #50: SLING-9795 - JUnit 5 support for server-side tests

Posted by GitBox <gi...@apache.org>.
bdelacretaz commented on a change in pull request #50:
URL: https://github.com/apache/sling-site/pull/50#discussion_r506309019



##########
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 1.1.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).

Review comment:
       "automatically switch to JUnit 5" might imply that JUnit 4 tests stop working when that switch is done.
   
   If that's not the case I would say "automatically activate JUnit 5 support" instead.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [sling-site] jsedding commented on a change in pull request #50: SLING-9795 - JUnit 5 support for server-side tests

Posted by GitBox <gi...@apache.org>.
jsedding commented on a change in pull request #50:
URL: https://github.com/apache/sling-site/pull/50#discussion_r506307479



##########
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:
       Fixed this after release before I saw your comment ;)




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [sling-site] jsedding commented on pull request #50: SLING-9795 - JUnit 5 support for server-side tests

Posted by GitBox <gi...@apache.org>.
jsedding commented on pull request #50:
URL: https://github.com/apache/sling-site/pull/50#issuecomment-713404938


   @kwin, @bdelacretaz I've changed several paragraphs, hoping it addresses the issues/questions you raised. Could you please have another look? Thanks!


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [sling-site] jsedding commented on a change in pull request #50: SLING-9795 - JUnit 5 support for server-side tests

Posted by GitBox <gi...@apache.org>.
jsedding commented on a change in pull request #50:
URL: https://github.com/apache/sling-site/pull/50#discussion_r506306029



##########
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.
+
+The most commonly used test engines are the "JUnit Jupiter Engine" for JUnit5 support and the "JUnit Vintage Engine", a backwards compatibility layer to allow running JUnit 4 tests on the new JUnit Platform.
+
+#### Bundles for the JUnit Jupiter Engine (JUnit 5)
+
+- org.junit.jupiter:junit-jupiter-api

Review comment:
       Yes, in addition to the JUnit Platform bundles.




----------------------------------------------------------------
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:
users@infra.apache.org