svn commit: r18761 - trunk/src/argouml-core-model/build.xml

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: linus
Date: 2010-09-18 06:37:33-0700
New Revision: 18761

Modified:
   trunk/src/argouml-core-model/build.xml

Log:
Added tests to ant build.

Modified: trunk/src/argouml-core-model/build.xml
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model/build.xml?view=diff&pathrev=18761&r1=18760&r2=18761
==============================================================================
--- trunk/src/argouml-core-model/build.xml	(original)
+++ trunk/src/argouml-core-model/build.xml	2010-09-18 06:37:33-0700
@@ -32,6 +32,40 @@
     <property name="debug" value="yes"/>
     <property name="deprecation" value="yes"/>
     <property name="optimize" value="yes"/>
+
+    <!-- Things for tests -->
+    <property name="tests.classes" value="${build.dir}/tests/classes"/>
+    <property name="tests.reports" value="${build.dir}/tests/reports"/>
+
+    <!-- Define a couple places we can find Junit -->
+    <!-- Try to figure out where our tools directory is. Done after overrides
+    are loaded so user can override, but before defaults -->
+    <property name="tool.test.file" value="checkstyle/java.header"/>
+    <available file="${argo.root.dir}/argouml-core-tools/${tool.test.file}" 
+        type="file" property="argo.tools.dir" value="${argo.root.dir}/argouml-core-tools"/>
+    <available file="../../tools/${tool.test.file}" 
+        type="file" property="argo.tools.dir" value="../../tools"/>
+  	
+    <path id="junit.classpath">
+      <pathelement location="${junit.jar.path}"/>
+      <pathelement location="${argo.tools.dir}/junit-3.8.2/junit.jar"/>
+    </path>
+
+    <path id="tests.compile.classpath">
+      <pathelement location="${build.classes}"/>
+      <path refid="junit.classpath"/>
+    </path>
+
+    <path id="tests.run.classpath">
+      <path refid="tests.compile.classpath"/>
+      <!-- The tests relies on that mdr is build before. -->
+      <fileset dir="../argouml-core-infra/build/">
+        <include name="*.jar"/>
+      </fileset>
+      <fileset dir="../argouml-core-model-mdr/build/">
+        <include name="*.jar"/>
+      </fileset>
+    </path>
   </target>
 
   <!-- =================================================================== -->
@@ -80,6 +114,69 @@
 
 
   <!-- =================================================================== -->
+  <!-- Compiles the tests directory                                        -->
+  <!-- =================================================================== -->
+  <target name="compile-tests"
+          depends="init,compile">
+    <!-- create directories -->
+    <mkdir dir="${tests.classes}"/>
+
+    <javac srcdir="tests"
+           destdir="${tests.classes}"
+           includes="org/argouml/**/*.java"
+           debug="${debug}"
+           deprecation="${deprecation}"
+           optimize="${optimize}"
+           source="1.5"
+           target="1.5"
+       >
+       <compilerarg compiler="javac1.5" line="-Xlint:unchecked"/>
+       <classpath>
+         <path refid="tests.compile.classpath"/>
+       </classpath>
+    </javac>
+    <copy todir="${tests.classes}">
+      <fileset dir="tests">
+        <include name="**/*.lcf"/>
+      </fileset>
+      <fileset dir="tests">
+        <include name="testmodels/**/*.xmi"/>
+        <include name="testmodels/**/*.xml.zip"/>
+        <include name="testmodels/**/*.xml"/>
+      </fileset>
+    </copy>
+  </target>
+
+  <!-- =================================================================== -->
+  <!-- Runs the tests                                                      -->
+  <!-- =================================================================== -->
+  <target name="tests-xml"
+          depends="init,compile,compile-tests">
+    <!-- create directories -->
+    <mkdir dir="${tests.reports}/junit/output"/>
+
+    <junit errorproperty="junit.failure" fork="yes" haltonfailure="false"
+           maxmemory="256M" printsummary="true">
+        <sysproperty key="log4j.configuration"
+                   value="org/argouml/resource/info_console.lcf"/>
+        <sysproperty key="argouml.model.implementation"
+                   value="org.argouml.model.mdr.MDRModelImplementation"/>
+      <classpath>
+        <pathelement location="${tests.classes}"/>
+        <path refid="tests.run.classpath"/>
+      </classpath>
+      <formatter type="xml"/>
+      <batchtest todir="${tests.reports}/junit/output">
+        <fileset dir="tests">
+          <include name="org/argouml/**/Test*.java"/>
+        </fileset>
+      </batchtest>
+    </junit>
+  </target>
+
+
+
+  <!-- =================================================================== -->
   <!-- Eclipse PDE targets from here to end of file                        -->
   <!-- =================================================================== -->
   <!--

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2661642

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.