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/08/04 21:20:34 UTC

svn commit: r1369459 - in /incubator/easyant/plugins/trunk/test-testng/src: main/resources/test-testng.ant test/ test/antunit/ test/antunit/test-testng-test.xml

Author: jlboudart
Date: Sat Aug  4 21:20:33 2012
New Revision: 1369459

URL: http://svn.apache.org/viewvc?rev=1369459&view=rev
Log:
Add testng basic test case, not tested through as i have no internet now :'(

Added:
    incubator/easyant/plugins/trunk/test-testng/src/test/
    incubator/easyant/plugins/trunk/test-testng/src/test/antunit/
    incubator/easyant/plugins/trunk/test-testng/src/test/antunit/test-testng-test.xml
Modified:
    incubator/easyant/plugins/trunk/test-testng/src/main/resources/test-testng.ant

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=1369459&r1=1369458&r2=1369459&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 Sat Aug  4 21:20:33 2012
@@ -21,34 +21,8 @@
 
     <ea:import mrid="org.apache.easyant.plugins#abstract-test;0.9" />
 
-    <target name="/skip" description="skip tests">
-        <property name="skip.test" value="true" />
-        <property name="skip.test.integration" value="true" />
-    </target>
-
     <target name="test-testng:init" depends="abstract-test:init">
         <ea:parameter property="testng.filename" description="testng configuration filename" default="testng.xml"/>
-
-        <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>
-
-        <condition property="skip.test">
-            <not><isset property="has.src.test.java"/></not>
-        </condition>
-
-        <condition property="skip.test.integration">
-            <not><isset property="has.src.test.integration.java"/></not>
-        </condition>
-    </target>
-
-    <target name="-test-testng:load">
         <available property="testng.available" classname="org.testng.TestNGAntTask">
             <classpath refid="run.test.classpath" />
         </available>
@@ -77,11 +51,11 @@
         </sequential>
     </macrodef>
 
-    <target name="-test-testng:test" depends="test-compile,-test-testng:load" unless="skip.test">
+    <target name="-test-testng:test" depends="test-testng:init,abstract-test:compute-test-sets" unless="skip.test">
         <testng-test prefix="test"/>
     </target>
 
-    <target name="-test-testng:integration-test" depends="test-compile,-load" unless="skip.test.integration">
+    <target name="-test-testng:integration-test" depends="test-testng:init,abstract-test:compute-test-sets" unless="skip.test.integration">
         <testng-test prefix="test.integration"/>
     </target>
 

Added: incubator/easyant/plugins/trunk/test-testng/src/test/antunit/test-testng-test.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/plugins/trunk/test-testng/src/test/antunit/test-testng-test.xml?rev=1369459&view=auto
==============================================================================
--- incubator/easyant/plugins/trunk/test-testng/src/test/antunit/test-testng-test.xml (added)
+++ incubator/easyant/plugins/trunk/test-testng/src/test/antunit/test-testng-test.xml Sat Aug  4 21:20:33 2012
@@ -0,0 +1,77 @@
+<!--
+   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.
+-->
+<project name="org.apache.easyant.plugins;test-testng-test" 
+    xmlns:au="antlib:org.apache.ant.antunit" 
+    xmlns:ivy="antlib:org.apache.ivy.ant"
+    xmlns:ea="antlib:org.apache.easyant">
+    
+    <!-- Import your plugin --> 
+    <property name="target" value="target/test-antunit"/>
+    <!-- configure easyant in current project -->
+    <ea:configure-easyant-ivy-instance />
+    <!-- import our local plugin -->
+    <ea:import-test-module moduleIvy="../../../module.ivy" sourceDirectory="../../main/resources"/>
+   
+    <!-- Defines a setUp / tearDown (before each test) that cleans the environnement --> 
+    <target name="clean" description="remove stale build artifacts before / after each test">
+        <delete dir="${basedir}" includeemptydirs="true">
+            <include name="**/target/**"/>
+            <include name="**/lib/**"/>
+        </delete>
+    </target>
+    
+    <!--TODO: add a testng sample -->
+    <!--FIXME: test-testng targets get executed as they are prefixed by "test" -->
+    <target name="setUp" depends="clean"/>
+    <target name="tearDown" depends="clean"/>
+    
+    <target name="test-test-testng:init" depends="test-testng:init">
+        <au:assertPropertyEquals name="testng.filename" value="testng.xml"/>
+    </target>
+
+    <target name="test-test-testng:test" depends="-test-testng:test">
+        <au:assertFileExists file="${target.test.xml}"/>
+    </target>
+
+    <target name="test-test-testng:integration-test" depends="-test-testng:integration-test">
+        <au:assertFileExists file="${target.test.xml}"/>
+    </target>
+    
+    <target name="test-test-testng:run">
+        <au:expectfailure 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">
+            <antcall target="test-testng:run">
+                <param name="test.mode.run" value="true"/>
+                <param name="test.failed" value="true"/>
+            </antcall>
+        </au:expectfailure>
+        
+    </target>
+
+    <target name="test-test-testng:run-integration">
+        <au:expectfailure 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">
+            <antcall target="test-testng:run-integration">
+                <param name="test.mode.run" value="true"/>
+                <param name="test.integration.failed" value="true"/>
+            </antcall>
+        </au:expectfailure>
+
+    </target>
+
+    <target name="test-test-testng:report" depends="test-testng:report">
+        <!--TODO: add this missing test case -->
+    </target>
+</project>