You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2014/11/10 15:23:11 UTC

maven-surefire git commit: [SUREFIRE-987] and [SUREFIRE-1109]

Repository: maven-surefire
Updated Branches:
  refs/heads/master 4183b3cbf -> 4713d3497


[SUREFIRE-987] and [SUREFIRE-1109]


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/4713d349
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/4713d349
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/4713d349

Branch: refs/heads/master
Commit: 4713d349760288ecc5dd1862874ce3b9abd1250e
Parents: 4183b3c
Author: tibordigana <ti...@lycos.com>
Authored: Mon Nov 10 14:51:08 2014 +0100
Committer: tibordigana <ti...@lycos.com>
Committed: Mon Nov 10 14:51:08 2014 +0100

----------------------------------------------------------------------
 .../plugin/failsafe/IntegrationTestMojo.java    | 57 +++++++++++++++++++
 .../plugin/surefire/AbstractSurefireMojo.java   | 59 ++------------------
 .../maven/plugin/surefire/SurefirePlugin.java   | 57 +++++++++++++++++++
 .../surefire/its/fixture/SurefireLauncher.java  |  2 +-
 .../src/test/resources/runOrder/pom.xml         |  6 --
 5 files changed, 119 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4713d349/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
index 3aec1a1..b15daf8 100644
--- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
+++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
@@ -224,6 +224,41 @@ public class IntegrationTestMojo
     @Parameter( property = "failsafe.rerunFailingTestsCount", defaultValue = "0" )
     protected int rerunFailingTestsCount;
 
+    /**
+     * (TestNG) List of &lt;suiteXmlFile> elements specifying TestNG suite xml file locations. Note that
+     * <code>suiteXmlFiles</code> is incompatible with several other parameters of this plugin, like
+     * <code>includes/excludes</code>.<br/>
+     * This parameter is ignored if the <code>test</code> parameter is specified (allowing you to run a single test
+     * instead of an entire suite).
+     *
+     * @since 2.2
+     */
+    @Parameter( property = "failsafe.suiteXmlFiles" )
+    private File[] suiteXmlFiles;
+
+    /**
+     * Defines the order the tests will be run in. Supported values are "alphabetical", "reversealphabetical", "random",
+     * "hourly" (alphabetical on even hours, reverse alphabetical on odd hours), "failedfirst", "balanced" and
+     * "filesystem".<p/>
+     * <p/>
+     * Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a
+     * multi-module build.<p/>
+     * <p/>
+     * Failed first will run tests that failed on previous run first, as well as new tests for this run.<p/>
+     * <p/>
+     * Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests reducing the
+     * overall execution time. Initially a statistics file is created and every next test run will reorder classes.<p/>
+     * <p/>
+     * Note that the statistics are stored in a file named .surefire-XXXXXXXXX beside pom.xml, and should not be checked
+     * into version control. The "XXXXX" is the SHA1 checksum of the entire surefire configuration, so different
+     * configurations will have different statistics files, meaning if you change any config settings you will re-run
+     * once before new statistics data can be established.
+     *
+     * @since 2.7
+     */
+    @Parameter( property = "failsafe.runOrder", defaultValue = "filesystem" )
+    protected String runOrder;
+
     protected int getRerunFailingTestsCount()
     {
         return rerunFailingTestsCount;
@@ -556,4 +591,26 @@ public class IntegrationTestMojo
     {
         this.includes = includes;
     }
+
+    public File[] getSuiteXmlFiles()
+    {
+        return suiteXmlFiles;
+    }
+
+    @SuppressWarnings( "UnusedDeclaration" )
+    public void setSuiteXmlFiles( File[] suiteXmlFiles )
+    {
+        this.suiteXmlFiles = suiteXmlFiles;
+    }
+
+    public String getRunOrder()
+    {
+        return runOrder;
+    }
+
+    @SuppressWarnings( "UnusedDeclaration" )
+    public void setRunOrder( String runOrder )
+    {
+        this.runOrder = runOrder;
+    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4713d349/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index 4bbb84b..bdfb553 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -413,18 +413,6 @@ public abstract class AbstractSurefireMojo
     protected String excludedGroups;
 
     /**
-     * (TestNG) List of &lt;suiteXmlFile> elements specifying TestNG suite xml file locations. Note that
-     * <code>suiteXmlFiles</code> is incompatible with several other parameters of this plugin, like
-     * <code>includes/excludes</code>.<br/>
-     * This parameter is ignored if the <code>test</code> parameter is specified (allowing you to run a single test
-     * instead of an entire suite).
-     *
-     * @since 2.2
-     */
-    @Parameter
-    protected File[] suiteXmlFiles;
-
-    /**
      * Allows you to specify the name of the JUnit artifact. If not set, <code>junit:junit</code> will be used.
      *
      * @since 2.3.1
@@ -662,30 +650,6 @@ public abstract class AbstractSurefireMojo
     protected Boolean parallelMavenExecution;
 
     /**
-     * Defines the order the tests will be run in. Supported values are "alphabetical", "reversealphabetical", "random",
-     * "hourly" (alphabetical on even hours, reverse alphabetical on odd hours), "failedfirst", "balanced" and
-     * "filesystem".
-     * <p/>
-     * <p/>
-     * Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a
-     * multi-module build.
-     * <p/>
-     * Failed first will run tests that failed on previous run first, as well as new tests for this run.
-     * <p/>
-     * Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests reducing the
-     * overall execution time. Initially a statistics file is created and every next test run will reorder classes.
-     * <p/>
-     * Note that the statistics are stored in a file named .surefire-XXXXXXXXX beside pom.xml, and should not be checked
-     * into version control. The "XXXXX" is the SHA1 checksum of the entire surefire configuration, so different
-     * configurations will have different statistics files, meaning if you change any config settings you will re-run
-     * once before new statistics data can be established.
-     *
-     * @since 2.7
-     */
-    @Parameter( defaultValue = "filesystem" )
-    protected String runOrder;
-
-    /**
      * List of dependencies to scan for test classes to include in the test run.
      * The child elements of this element must be &lt;dependency&gt; elements, and the
      * contents of each of these elements must be a string which follows the format:
@@ -2518,7 +2482,6 @@ public abstract class AbstractSurefireMojo
 
     }
 
-
     public abstract List<String> getIncludes();
 
     public File getIncludesFile()
@@ -2739,16 +2702,9 @@ public abstract class AbstractSurefireMojo
         this.excludedGroups = excludedGroups;
     }
 
-    public File[] getSuiteXmlFiles()
-    {
-        return suiteXmlFiles;
-    }
+    public abstract File[] getSuiteXmlFiles();
 
-    @SuppressWarnings( "UnusedDeclaration" )
-    public void setSuiteXmlFiles( File[] suiteXmlFiles )
-    {
-        this.suiteXmlFiles = suiteXmlFiles;
-    }
+    public abstract void setSuiteXmlFiles( File[] suiteXmlFiles );
 
     public String getJunitArtifactName()
     {
@@ -2987,16 +2943,9 @@ public abstract class AbstractSurefireMojo
         return parallelMavenExecution != null && parallelMavenExecution;
     }
 
-    public String getRunOrder()
-    {
-        return runOrder;
-    }
+    public abstract String getRunOrder();
 
-    @SuppressWarnings( "UnusedDeclaration" )
-    public void setRunOrder( String runOrder )
-    {
-        this.runOrder = runOrder;
-    }
+    public abstract void setRunOrder( String runOrder );
 
     public String[] getDependenciesToScan()
     {

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4713d349/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
----------------------------------------------------------------------
diff --git a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
index 714d79d..a384449 100644
--- a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
+++ b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
@@ -200,6 +200,41 @@ public class SurefirePlugin
     @Parameter( property = "surefire.rerunFailingTestsCount", defaultValue = "0" )
     protected int rerunFailingTestsCount;
 
+    /**
+     * (TestNG) List of &lt;suiteXmlFile> elements specifying TestNG suite xml file locations. Note that
+     * <code>suiteXmlFiles</code> is incompatible with several other parameters of this plugin, like
+     * <code>includes/excludes</code>.<br/>
+     * This parameter is ignored if the <code>test</code> parameter is specified (allowing you to run a single test
+     * instead of an entire suite).
+     *
+     * @since 2.2
+     */
+    @Parameter( property = "surefire.suiteXmlFiles" )
+    private File[] suiteXmlFiles;
+
+    /**
+     * Defines the order the tests will be run in. Supported values are "alphabetical", "reversealphabetical", "random",
+     * "hourly" (alphabetical on even hours, reverse alphabetical on odd hours), "failedfirst", "balanced" and
+     * "filesystem".<p/>
+     * <p/>
+     * Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a
+     * multi-module build.<p/>
+     * <p/>
+     * Failed first will run tests that failed on previous run first, as well as new tests for this run.<p/>
+     * <p/>
+     * Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests reducing the
+     * overall execution time. Initially a statistics file is created and every next test run will reorder classes.<p/>
+     * <p/>
+     * Note that the statistics are stored in a file named .surefire-XXXXXXXXX beside pom.xml, and should not be checked
+     * into version control. The "XXXXX" is the SHA1 checksum of the entire surefire configuration, so different
+     * configurations will have different statistics files, meaning if you change any config settings you will re-run
+     * once before new statistics data can be established.
+     *
+     * @since 2.7
+     */
+    @Parameter( property = "surefire.runOrder", defaultValue = "filesystem" )
+    protected String runOrder;
+
     protected int getRerunFailingTestsCount()
     {
         return rerunFailingTestsCount;
@@ -506,4 +541,26 @@ public class SurefirePlugin
     {
         this.includes = includes;
     }
+
+    public File[] getSuiteXmlFiles()
+    {
+        return suiteXmlFiles;
+    }
+
+    @SuppressWarnings( "UnusedDeclaration" )
+    public void setSuiteXmlFiles( File[] suiteXmlFiles )
+    {
+        this.suiteXmlFiles = suiteXmlFiles;
+    }
+
+    public String getRunOrder()
+    {
+        return runOrder;
+    }
+
+    @SuppressWarnings( "UnusedDeclaration" )
+    public void setRunOrder( String runOrder )
+    {
+        this.runOrder = runOrder;
+    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4713d349/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
index 2cd69ff..d78deb1 100755
--- a/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
+++ b/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/fixture/SurefireLauncher.java
@@ -270,7 +270,7 @@ public class SurefireLauncher
 
     public SurefireLauncher runOrder( String runOrder )
     {
-        mavenLauncher.sysProp( "runOrder", runOrder );
+        mavenLauncher.sysProp( "surefire.runOrder", runOrder );
         return this;
     }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/4713d349/surefire-integration-tests/src/test/resources/runOrder/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-integration-tests/src/test/resources/runOrder/pom.xml b/surefire-integration-tests/src/test/resources/runOrder/pom.xml
index 3cbae14..1319a58 100644
--- a/surefire-integration-tests/src/test/resources/runOrder/pom.xml
+++ b/surefire-integration-tests/src/test/resources/runOrder/pom.xml
@@ -45,14 +45,8 @@
         <version>${surefire.version}</version>
         <configuration>
           <forkMode>once</forkMode>
-          <runOrder>${runOrder}</runOrder>
         </configuration>
         <dependencies>
-          <!-- dependency>
-              <groupId>org.apache.maven.surefire</groupId>
-              <artifactId>${testProvider}</artifactId>
-              <version>${surefire.version}</version>
-          </dependency -->
         </dependencies>
       </plugin>
     </plugins>