Tibor17 commented on a change in pull request #347:
URL: https://github.com/apache/maven-surefire/pull/347#discussion_r615042662



##########
File path: 
maven-surefire-plugin/src/site/apt/examples/fork-options-and-parallel-execution.apt.vm
##########
@@ -181,6 +181,67 @@ Fork Options and Parallel Test Execution
   See the keywords: <volatile>, <synchronized>, <<immutable>> and <final> in
   {{{https://jcp.org/en/jsr/detail?id=133}Java Memory Model - JSR-133}}.
 
+* Parallel Test-Suite Execution
+
+  ${project.artifactId}'s notion of "suite" is related to
+  
{{{https://github.com/junit-team/junit4/wiki/Aggregating-tests-in-suites}junit4 
Suite}}. 
+
+  For example, say your tests are laid out like this:
+
++---+
+src/test/java
++-features.areaA
+| +-SomeStory.java
+| +-AnotherStory.java
+| ...
++-features.areaB
+| +-DifferentStory.java
+| +-OtherStory.java
+| ...
+...
++---+
+
+  You would add a TestSuite.java for each package, that would look something 
like:
+
++---+
+package features.areaA;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    SomeStory.class,
+    AnotherStory.class,
+    ...
+})
+public class TestSuite {
+    /* Suite holder */
+}
++---+
+
+  and similarly for <<<package features.areaB>>>. You would then configure
+  ${project.artifactId} like so:
+
++---+
+<plugin>
+  <groupId>${project.groupId}</groupId>
+  <artifactId>${project.artifactId}</artifactId>
+  <version>${project.version}</version>
+  <configuration>
+    <includes>
+      <include>features.*.*Suite</include>
+    </includes>
+    <parallel>suites</parallel>
+    <threadCount>4</threadCount>

Review comment:
       > Could you please explain what you mean. Especially "use another number 
but the effect would be different". I do not understand.
   > In my actual use-case I am running into problems where a bunch of tests 
pass and a bunch fail, and I do not know why.
   
   I wanted to say that Surefire nested suites in third level are not running 
in parallel.
   Your example is okay, it has package `featureA` and it means that `featureB` 
is concurrent. But I want to say that our users should not expect that a nested 
package `featureA.pkg1` and `featureA.pkg2` would be concurrent. The Surefire 
would run `pkg1` and `pkg2` in a sequence.  I guess you know what I mean. If 
somebody expects making them parallel then he would use 4 threads or 8 threads 
but I think it would not be... So hopefully your case works but the users 
should not expect any generic approach with infinite depth of parallel suites.




-- 
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


Reply via email to