sormuras commented on a change in pull request #184: Donate current sources 
from junit-platform-surefire-provider
URL: https://github.com/apache/maven-surefire/pull/184#discussion_r191075060
 
 

 ##########
 File path: maven-surefire-plugin/src/site/apt/examples/junit-platform.apt.vm
 ##########
 @@ -0,0 +1,206 @@
+ ------
+ Using JUnit Platform
+ ------
+ JUnit Lambda Team <junit-lambda-t...@googlegroups.com>
+ ------
+ 2018-05-14
+ ------
+ 
+ ~~ Licensed to the Apache Software Foundation (ASF) under one
+ ~~ or more contributor license agreements.  See the NOTICE file
+ ~~ distributed with this work for additional information
+ ~~ regarding copyright ownership.  The ASF licenses this file
+ ~~ to you under the Apache License, Version 2.0 (the
+ ~~ "License"); you may not use this file except in compliance
+ ~~ with the License.  You may obtain a copy of the License at
+ ~~
+ ~~   http://www.apache.org/licenses/LICENSE-2.0
+ ~~
+ ~~ Unless required by applicable law or agreed to in writing,
+ ~~ software distributed under the License is distributed on an
+ ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~~ KIND, either express or implied.  See the License for the
+ ~~ specific language governing permissions and limitations
+ ~~ under the License.
+
+ ~~ NOTE: For help with the syntax of this file, see:
+ ~~ http://maven.apache.org/doxia/references/apt-format.html 
+
+Using JUnit Platform
+
+* Configuring JUnit Platform
+
+  To get started with JUnit Platform, you need to add at least a single 
<<<TestEngine>>> implementation
+  to your project. For example, if you want to write tests with Jupiter, you 
must add the
+  <<<junit-jupiter-engine>>> to the dependencies like:
+
++---+
+<dependencies>
+  [...]
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <version>5.2.0</version>
+      <scope>test</scope>
+    </dependency>
+  [...]
+</dependencies>
++---+
+
+  This will pull in all required dependencies. Among those dependencies is 
<<<junit-jupiter-api>>> which contains
+  the classes and interfaces your test source requires to compile. 
<<<junit-platform-engine>>> is also resolved and
+  added.
+
+  This is the only step that is required to get started - you can now create 
tests in your test source directory
+  (e.g., <<<src/test/java>>>).
+
+  If you want to write and execute JUnit 3 or 4 tests via the JUnit Platform 
add the Vintage Engine to your projects'
+  dependencies:
+
++---+
+<dependencies>
+  [...]
+    <dependency>
+      <groupId>org.junit.vintage</groupId>
+      <artifactId>junit-vintage-engine</artifactId>
+      <version>5.2.0</version>
+      <scope>test</scope>
+    </dependency>
+  [...]
+</dependencies>
++---+
+
+* Provider Selection
+
+   If nothing is configured, Surefire detects which JUnit version to use by 
the following algorithm:
+
++---+
+if the JUnit Platform Engine is present in the project
+    use junit-platform
+if the JUnit version in the project >= 4.7 and the parallel attribute has ANY 
value
+    use junit47 provider
+if JUnit >= 4.0 is present
+    use junit4 provider
+else
+    use junit3.8.1
++---+
+
+  When using this technique there is no check that the proper test-frameworks 
are present on your project's
+  classpath. Failing to add the proper test-frameworks will result in a build 
failure.
+
+* Running Tests in Parallel
+
+  From JUnit Platform does not support running tests in parallel.
+
+* Running a Single Test Class
+
+   The JUnit Platform Provider supports the <<<test>>> JVM system property 
supported by
+   the Maven Surefire Plugin. For example, to run only test methods in the 
<<<org.example.MyTest>>> test class
+   you can execute <<<mvn -Dtest=org.example.MyTest test>>> from the command 
line.
+
+
+* Filtering by Test Class Names
+
+   The Maven Surefire Plugin will scan for test classes whose fully qualified 
names match
+   the following patterns.
+
+   * <<<**/Test*.java>>>
+
+   * <<<**/*Test.java>>>
+
+   * <<<**/*Tests.java>>>
+
+   * <<<**/*TestCase.java>>>
+
+Moreover, it will exclude all nested classes (including static member classes) 
by default.
+
+Note, however, that you can override this default behavior by configuring 
explicit
+`include` and `exclude` rules in your `pom.xml` file. For example, to keep 
Maven Surefire
+from excluding static member classes, you can override its exclude rules.
+
+Overriding exclude rules of Maven Surefire
+
++---+
+...
+<build>
+    <plugins>
+        ...
+        <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <version>{surefire-version}</version>
+            <configuration>
+                <excludes>
+                    <exclude/>
+                </excludes>
+            </configuration>
+            ...
+        </plugin>
+    </plugins>
+</build>
+...
++---+
+
+
+* Filtering by Tags
+
+You can filter tests by tags or tag expressions using the following 
configuration properties.
+
+    * to include <<<tags>>> or <<<tag expressions>>>, use either <<<groups>>> 
or <<<includeTags>>>.
+
+    * to exclude <<<tags>>> or <<<tag expressions>>>, use either 
<<<excludedGroups>>> or <<<excludeTags>>>.
+
++---+
+...
+<build>
+    <plugins>
+        ...
+        <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <version>{surefire-version}</version>
+            <configuration>
+                <properties>
+                    <includeTags>acceptance | !feature-a</includeTags>
+                    <excludeTags>integration, regression</excludeTags>
+                </properties>
+            </configuration>
+            <dependencies>
+                ...
+            </dependencies>
+        </plugin>
+    </plugins>
+</build>
+...
++---+
+
+
+* Configuration Parameters
+
+   You can set JUnit Platform configuration parameters to influence test 
discovery and execution by
+   declaring the <<<configurationParameters>>> property and providing 
key-value pairs using the Java
+   <<<Properties>>> file syntax (as shown below) or via the 
<<<junit-platform.properties>>> file.
+
++---+
+...
+<build>
+    <plugins>
+        ...
+        <plugin>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <version>{surefire-version}</version>
+            <configuration>
+                <properties>
+                    <configurationParameters>
+                        junit.jupiter.conditions.deactivate = *
 
 Review comment:
   Where can I find the _escape and transfer_ code in CLI @Tibor17 ?
   
   As long as newline separators are transfered (doesn't matter which one is 
received on the forked VM) the loading via 
[Properties.load](https://docs.oracle.com/javase/10/docs/api/java/util/Properties.html#load(java.io.Reader))
 will be fine.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

Reply via email to