You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2019/06/02 08:56:44 UTC

[GitHub] [maven-surefire] cardil commented on a change in pull request #112: Adding support for externally passed random seed and printing used seed on console

cardil commented on a change in pull request #112: Adding support for externally passed random seed and printing used seed on console
URL: https://github.com/apache/maven-surefire/pull/112#discussion_r289633130
 
 

 ##########
 File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
 ##########
 @@ -181,6 +183,30 @@ public void runStarting()
             log( "-------------------------------------------------------" );
             log( " T E S T S" );
             log( "-------------------------------------------------------" );
+            displayRandomization();
+        }
+    }
+
+    private boolean isRandomized()
+    {
+        return reportConfiguration.getRunOrderParameters() != null
+                && reportConfiguration.getRunOrderParameters().isRandomized();
+    }
+
+    private void displayRandomization()
+    {
+        if ( isRandomized() )
+        {
+            final Randomizer randomizer = reportConfiguration.getRunOrderParameters().getRandomizer();
+            final String pluginName = reportConfiguration.getPluginName();
+
+            log( "" );
+            log( String.format(
+                    "Tests are randomly ordered. Re-run the same execution order"
+                            + " with -D%s.runOrder=random:%d",
+                    pluginName, randomizer.getSeed()
+            ) );
+            log( "" );
 
 Review comment:
   This is "\n", just like the code in `runCompleted()` (just beneath) that existed before.

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


With regards,
Apache Git Services