You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by jl...@apache.org on 2012/07/08 19:14:11 UTC

svn commit: r1358818 - in /incubator/easyant/plugins/trunk: abstract-test/src/main/resources/abstract-test.ant test-junit/src/main/resources/test-junit.ant test-testng/src/main/resources/test-testng.ant

Author: jlboudart
Date: Sun Jul  8 19:14:11 2012
New Revision: 1358818

URL: http://svn.apache.org/viewvc?rev=1358818&view=rev
Log:
Factorizing stuff in abstract-test plugin

Modified:
    incubator/easyant/plugins/trunk/abstract-test/src/main/resources/abstract-test.ant
    incubator/easyant/plugins/trunk/test-junit/src/main/resources/test-junit.ant
    incubator/easyant/plugins/trunk/test-testng/src/main/resources/test-testng.ant

Modified: incubator/easyant/plugins/trunk/abstract-test/src/main/resources/abstract-test.ant
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/abstract-test/src/main/resources/abstract-test.ant?rev=1358818&r1=1358817&r2=1358818&view=diff
==============================================================================
--- incubator/easyant/plugins/trunk/abstract-test/src/main/resources/abstract-test.ant (original)
+++ incubator/easyant/plugins/trunk/abstract-test/src/main/resources/abstract-test.ant Sun Jul  8 19:14:11 2012
@@ -60,13 +60,16 @@
 
         <ea:parameter property="test.mode" default="run"
             description="mode to use to execute tests: 'run' to only run tests, 'report' to generate html report" />
-        <ea:parameter property="javac.debug.mode" default="true" 
+        
+    	<ea:parameter property="javac.debug.mode" default="true" 
             description="javac debug mode, true or false" />
-        <ea:parameter property="test.compile.includes.pattern" default="**/*.java" 
+        
+    	<ea:parameter property="test.compile.includes.pattern" default="**/*.java" 
             description="Pattern describing files included in test compilation process" />
         <ea:parameter property="test.compile.excludes.pattern" default="" 
             description="Pattern describing files excluded in test compilation process" />
-        <ea:parameter property="test.integration.compile.includes.pattern" default="**/*.java" 
+        
+    	<ea:parameter property="test.integration.compile.includes.pattern" default="**/*.java" 
             description="Pattern describing files included in integration test compilation process" />
         <ea:parameter property="test.integration.compile.excludes.pattern" default="" 
             description="Pattern describing files excluded in integration test compilation process" />
@@ -81,6 +84,42 @@
                 <pathelement location="${target.main.classes}" />
                 <path refid="compile.main.classpath" />
         </path>
+    	
+	    <ea:parameter property="test.run.dir"
+            default="${basedir}" description="working directory for unit test process, defaults to the project basedir"/>
+        <ea:parameter property="test.integration.run.dir"
+            default="${basedir}" description="working directory for integration test process, defaults to the project basedir"/>
+
+        <ea:parameter property="test.scan.path" default="false"
+                      description="if true, the full test classpath will be scanned for additional test cases to run"/>
+        <ea:parameter property="test.jar.pattern" default=".*-test.jar"
+                      description="when test.scan.path is enabled, identifies which jars should be examined for test cases"/>
+
+        <ea:parameter property="test.integration.scan.path" default="false"
+                      description="if true, the full integration test classpath will be scanned for additional test cases to run"/>
+        <ea:parameter property="test.integration.jar.pattern" default=".*-test.jar"
+                      description="when test.scan.path is enabled, identifies which jars should be examined for test cases"/>
+        
+        <ea:parameter property="test.run.includes.pattern" 
+            default="**/*" description="Pattern describing class files included in test run" /> 
+        <ea:parameter property="test.run.excludes.pattern" 
+            default="" description="Pattern describing class files excluded in test run" />
+
+        <ea:parameter property="test.integration.run.includes.pattern" 
+            default="**/*" description="Pattern describing class files included in integration test run" /> 
+        <ea:parameter property="test.integration.run.excludes.pattern" 
+            default="" description="Pattern describing class files excluded in integration test run" />
+
+        <ea:path pathid="run.test.classpath" overwrite="append-if-not-exist">
+            <pathelement location="${target.test.classes}" />
+            <path refid="compile.test.classpath" />
+        </ea:path>
+
+        <ea:path pathid="run.test.integration.classpath" overwrite="append-if-not-exist">
+            <pathelement location="${target.test.integration.classes}" />
+            <path refid="compile.test.classpath" />
+        </ea:path>
+
 
         <available file="${src.test.java}" property="has.src.test.java" />
         <available file="${src.test.integration.java}" property="has.src.test.integration.java"/>
@@ -101,6 +140,79 @@
 
     </target>
 
+    <target name="abstract-test:compute-test-sets" depends="abstract-test:test-ready" description="compute the set of test cases to run">
+        <compute-test-path prefix="test">
+            <path refid="compile.test.classpath" />
+        </compute-test-path>
+
+        <compute-test-path prefix="test.integration">
+            <path refid="compile.test.classpath" />
+        </compute-test-path>
+    </target>
+	
+    <macrodef name="compute-test-path" description="Compute the set of test cases to run.">
+        <attribute name="prefix" description="one of 'test' or 'test.integration'"/>
+        <attribute name="test-archive-pattern" default=".*-test.jar" description="Name pattern for jar files on the input class path that may contain test cases."/>
+        <element name="test-path" implicit="true" description="the classpath to search for test cases"/>
+        <sequential>
+
+            <!-- declare test case resource set -->
+            <resources id="target.@{prefix}.set">
+                <fileset dir="${target.@{prefix}.classes}"
+                         includes="${@{prefix}.run.includes.pattern}"
+                         excludes="${@{prefix}.run.excludes.pattern}"
+                         erroronmissingdir="false"/>
+            </resources>
+
+            <if>
+                <istrue value="${@{prefix}.scan.path}"/>
+                <then>
+                    <for param="test.collection">
+                        <test-path/>
+                        <sequential>
+                            <echo level="verbose">Examining @{test.collection} for test cases</echo>
+                            <if>
+                                <and>
+                                    <available file="@{test.collection}" type="file"/>
+                                    <matches string="@{test.collection}" pattern="${@{prefix}.jar.pattern}"/>
+                                </and>
+                                <then>
+                                    <echo level="verbose">Adding test cases from test jar @{test.collection}</echo>
+                                    <augment id="target.@{prefix}.set">
+                                        <zipfileset src="@{test.collection}" includes="${@{prefix}.run.includes.pattern}" excludes="${@{prefix}.run.excludes.pattern}"/>
+                                    </augment>
+                                </then>
+                                <else>
+                                    <if>
+                                        <available file="@{test.collection}" type="dir"/>
+                                        <then>
+                                            <echo level="verbose">Adding test cases from test class directory @{test.collection}</echo>
+                                            <augment id="target.@{prefix}.set">
+                                                <fileset dir="@{test.collection}" includes="${@{prefix}.run.includes.pattern}" excludes="${@{prefix}.run.excludes.pattern}"/>
+                                            </augment>
+                                        </then>
+                                        <else>
+                                            <echo level="verbose">Test path entry @{test.collection} does not appear to be a directory or a test jar, skipping</echo>
+                                        </else>
+                                    </if>
+                                </else>
+                            </if>
+                        </sequential>
+                    </for>
+                </then>
+                <else>
+                    <echo level="verbose">Test path scanning disabled by property @{prefix}.scan.path</echo>
+                </else>
+            </if>
+
+            <condition property="skip.@{prefix}">
+                <resourcecount refid="target.@{prefix}.set" when="equal" count="0"/>
+            </condition>
+
+        </sequential>
+    </macrodef>
+
+
     <macrodef name="check-test-result" description="check test results">
         <attribute name="propertytocheck"/>
         <attribute name="message" />

Modified: incubator/easyant/plugins/trunk/test-junit/src/main/resources/test-junit.ant
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/test-junit/src/main/resources/test-junit.ant?rev=1358818&r1=1358817&r2=1358818&view=diff
==============================================================================
--- incubator/easyant/plugins/trunk/test-junit/src/main/resources/test-junit.ant (original)
+++ incubator/easyant/plugins/trunk/test-junit/src/main/resources/test-junit.ant Sun Jul  8 19:14:11 2012
@@ -23,16 +23,6 @@
     <ea:import mrid="org.apache.easyant.plugins#antcontrib-activator;0.9" />
 
     <target name="test-junit:init" depends="abstract-test:init">
-        <ea:parameter property="test.run.includes.pattern" 
-            default="**/*" description="Pattern describing class files included in test run" /> 
-        <ea:parameter property="test.run.excludes.pattern" 
-            default="" description="Pattern describing class files excluded in test run" />
-
-        <ea:parameter property="test.integration.run.includes.pattern" 
-            default="**/*" description="Pattern describing class files included in integration test run" /> 
-        <ea:parameter property="test.integration.run.excludes.pattern" 
-            default="" description="Pattern describing class files excluded in integration test run" />
-
         <ea:parameter property="test.run.forkmode"
             default="perTest" description="The forkmode for junit tests; 'perTest' or 'once'"/>
         <ea:parameter property="test.run.fork"
@@ -46,98 +36,8 @@
             default="true" description="Run integration tests in a separate VM. (true/false)"/>
         <ea:parameter property="test.integration.run.jvmargs"
             default="" description="Extra parameters to pass to the integration test JVM, for example to enable debugging"/>
-
-        <ea:parameter property="target.test.xml" required="true" 
-            description="Directory were xml test reports will be generated"/>
-        <ea:parameter property="test.run.dir"
-            default="${basedir}" description="working directory for unit test process, defaults to the project basedir"/>
-        <ea:parameter property="test.integration.run.dir"
-            default="${basedir}" description="working directory for integration test process, defaults to the project basedir"/>
-
-        <ea:parameter property="test.scan.path" default="false"
-                      description="if true, the full test classpath will be scanned for additional test cases to run"/>
-        <ea:parameter property="test.jar.pattern" default=".*-test.jar"
-                      description="when test.scan.path is enabled, identifies which jars should be examined for test cases"/>
-
-        <ea:parameter property="test.integration.scan.path" default="false"
-                      description="if true, the full integration test classpath will be scanned for additional test cases to run"/>
-        <ea:parameter property="test.integration.jar.pattern" default=".*-test.jar"
-                      description="when test.scan.path is enabled, identifies which jars should be examined for test cases"/>
-
-        <ea:path pathid="run.test.classpath" overwrite="append-if-not-exist">
-            <pathelement location="${target.test.classes}" />
-            <path refid="compile.test.classpath" />
-        </ea:path>
-
-        <ea:path pathid="run.test.integration.classpath" overwrite="append-if-not-exist">
-            <pathelement location="${target.test.integration.classes}" />
-            <path refid="compile.test.classpath" />
-        </ea:path>
-
     </target>
 
-    <macrodef name="compute-test-path" description="Compute the set of test cases to run.">
-        <attribute name="prefix" description="one of 'test' or 'test.integration'"/>
-        <attribute name="test-archive-pattern" default=".*-test.jar" description="Name pattern for jar files on the input class path that may contain test cases."/>
-        <element name="test-path" implicit="true" description="the classpath to search for test cases"/>
-        <sequential>
-
-            <!-- declare test case resource set -->
-            <resources id="target.@{prefix}.set">
-                <fileset dir="${target.@{prefix}.classes}"
-                         includes="${@{prefix}.run.includes.pattern}"
-                         excludes="${@{prefix}.run.excludes.pattern}"
-                         erroronmissingdir="false"/>
-            </resources>
-
-            <if>
-                <istrue value="${@{prefix}.scan.path}"/>
-                <then>
-                    <for param="test.collection">
-                        <test-path/>
-                        <sequential>
-                            <echo level="verbose">Examining @{test.collection} for test cases</echo>
-                            <if>
-                                <and>
-                                    <available file="@{test.collection}" type="file"/>
-                                    <matches string="@{test.collection}" pattern="${@{prefix}.jar.pattern}"/>
-                                </and>
-                                <then>
-                                    <echo level="verbose">Adding test cases from test jar @{test.collection}</echo>
-                                    <augment id="target.@{prefix}.set">
-                                        <zipfileset src="@{test.collection}" includes="${@{prefix}.run.includes.pattern}" excludes="${@{prefix}.run.excludes.pattern}"/>
-                                    </augment>
-                                </then>
-                                <else>
-                                    <if>
-                                        <available file="@{test.collection}" type="dir"/>
-                                        <then>
-                                            <echo level="verbose">Adding test cases from test class directory @{test.collection}</echo>
-                                            <augment id="target.@{prefix}.set">
-                                                <fileset dir="@{test.collection}" includes="${@{prefix}.run.includes.pattern}" excludes="${@{prefix}.run.excludes.pattern}"/>
-                                            </augment>
-                                        </then>
-                                        <else>
-                                            <echo level="verbose">Test path entry @{test.collection} does not appear to be a directory or a test jar, skipping</echo>
-                                        </else>
-                                    </if>
-                                </else>
-                            </if>
-                        </sequential>
-                    </for>
-                </then>
-                <else>
-                    <echo level="verbose">Test path scanning disabled by property @{prefix}.scan.path</echo>
-                </else>
-            </if>
-
-            <condition property="skip.@{prefix}">
-                <resourcecount refid="target.@{prefix}.set" when="equal" count="0"/>
-            </condition>
-
-        </sequential>
-    </macrodef>
-
     <macrodef name="junit-test">
         <attribute name="prefix"/>
         <sequential>
@@ -170,17 +70,7 @@
         </sequential>
     </macrodef>
 
-    <target name="-test-junit:compute-test-sets" depends="abstract-test:test-ready" description="compute the set of test cases to run">
-        <compute-test-path prefix="test">
-            <path refid="compile.test.classpath" />
-        </compute-test-path>
-
-        <compute-test-path prefix="test.integration">
-            <path refid="compile.test.classpath" />
-        </compute-test-path>
-    </target>
-
-    <target name="-test-junit:test" depends="-test-junit:compute-test-sets" unless="skip.test">
+    <target name="-test-junit:test" depends="abstract-test:compute-test-sets" unless="skip.test">
         <junit-test prefix="test"/>
     </target>
 

Modified: incubator/easyant/plugins/trunk/test-testng/src/main/resources/test-testng.ant
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/test-testng/src/main/resources/test-testng.ant?rev=1358818&r1=1358817&r2=1358818&view=diff
==============================================================================
--- incubator/easyant/plugins/trunk/test-testng/src/main/resources/test-testng.ant (original)
+++ incubator/easyant/plugins/trunk/test-testng/src/main/resources/test-testng.ant Sun Jul  8 19:14:11 2012
@@ -85,12 +85,12 @@
         <testng-test prefix="test.integration"/>
     </target>
 
-    <target name="test-testng::run" if="test.mode.run" unless="skip.test" depends="-test-testng:test" description="run testng tests">
+    <target name="test-testng:run" if="test.mode.run" unless="skip.test" depends="-test-testng:test" description="run testng tests">
         <check-test-result propertytocheck="test.failed"
               message="At least one test has failed. See logs in ${target.test.xml} for details or use the report target to run the test with a report" />
     </target>
 
-    <target name="test-testng::run-integration" if="test.mode.run" unless="skip.test.integration" depends="-test-testng:integration-test" description="run testng integration tests">
+    <target name="test-testng:run-integration" if="test.mode.run" unless="skip.test.integration" depends="-test-testng:integration-test" description="run testng integration tests">
         <check-test-result propertytocheck="test.integration.failed"
               message="At least one integration test has failed. See logs in ${target.test.xml} for details or use the report target to run the test with a report" />
     </target>