|
|
|
Re: Running jUnit from and with eclipse front-end [message #145194 is a reply to message #145124] |
Wed, 25 February 2004 11:42 |
Jiri Mares Messages: 18 Registered: July 2009 |
Junior Member |
|
|
It's not exacly what I'm looking for, but it's good base for my
investigation
Ray Tayek wrote:
> "Jiří Mareš" <Jiri.Mares@svt.cz> wrote in message
> news:c1fnri$bds$1@eclipse.org...
>
>>Hi,
>>
>>I would like to ask, is there any way how to run jUnit tests from ant
>>task with eclipse frontent to jUnit.
>
>
> not sure if this is what you want, but you can run junit tests from ant from
> within eclipse. (see below)
>
>
>>Why? I would like to use aspectj before running tests and I don't know
>>how to run automatically aspectJ compiler from eclipse - just from ant :-(
>>...
>
>
> hth
>
> <?xml version="1.0" encoding="UTF-8"?>
> <project basedir="." default="all" name="mappingtools">
> <property environment="env"/>
> <property file="${user.home}/build.properties"/>
> <property file="build.properties"/>
> <!-- may want to set out own build compiler -->
> <target name="checkforeclipse" if="eclipse.running">
> <property name="build.compiler"
> value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
> <echo message="junit.home=${junit.home}"/>
> <property name="junit.jar"
> value="${eclipse.home}\plugins\org.junit_3.8.1\junit.jar"/ >
> </target>
> <target name="init" depends="checkforeclipse">
> <echo message="user.home=${user.home}"/>
> <echo message="ant.home=${ant.home}"/>
> <property name="junit.jar" value="${ant.home}/lib/junit.jar"/><!-- usually
> one hangs out here -->
> <echo message="junit.jar=${junit.jar}"/><!-- this has /'s and \'s on
> windoze xp! -->
> <fail unless="junit.jar">no ant.home!</fail>
> <mkdir dir="build"/>
> </target>
> <target name="clean" depends="init" description="clean">
> <delete dir="dist"/>
> <delete dir="build"/>
> <delete dir="doc/apidoc"/>
> <delete dir="deleted"/>
> </target>
> <target name="compile" depends="init" description="compile">
> <mkdir dir="build"/>
> <mkdir dir="build/classes"/>
> <mkdir dir="build/classes/srcobj"/>
> <javac debug="true" deprecation="true" destdir="build/classes/srcobj"
> srcdir="src">
> <classpath>
> <pathelement location="lib/ostermillerutils_1_02_21.jar"/>
> </classpath>
> </javac>
> </target>
> <target name="compiletst" depends="init,compile" description="compile
> tests">
> <mkdir dir="build/classes/tstobj"/>
> <javac debug="true" deprecation="true" destdir="build/classes/tstobj"
> srcdir="tst">
> <classpath>
> <pathelement location="lib/ostermillerutils_1_02_21.jar"/>
> <pathelement location="${junit.jar}"/>
> <pathelement location="build/classes/srcobj"/>
> </classpath>
> </javac>
> <mkdir dir="build/classes/tstobj/com/ediidea/mappingtools/testfiles "/>
> <copy todir="build/classes/tstobj/com/ediidea/mappingtools/testfiles ">
> <fileset dir="tst/com/ediidea/mappingtools/testfiles" includes="*.*"
> excludes="*.nbattrs"/>
> </copy>
> </target>
> <target name="jar" depends="init,compile" description="jar">
> <mkdir dir="build/lib"/>
> <jar basedir="build/classes/srcobj" compress="true"
> jarfile="build/lib/mappingtools.jar">
> <exclude name="**/deleted/**"/>
> <exclude name="**/RCS/**"/>
> <exclude name="*.class"/><!-- exclude default package classes-->
> </jar>
> </target>
> <target name="all" depends="init,junit">
> </target>
> <!-- figure out how (where) to deliver stuff -->
> <target name="deliver" depends="init,jar" description="deliver">
> <property name="delivery.dir" value="${user.home}/java/tmp/rel"/>
> <mkdir dir="${delivery.dir}"/>
> <mkdir dir="${delivery.dir}/lib"/>
> <copy todir="${delivery.dir}/lib">
> <fileset dir="build/lib" includes="*.jar"/>
> </copy>
> <mkdir dir="${delivery.dir}/bin"/>
> <copy todir="${delivery.dir}/bin">
> <fileset dir="sh" includes="checkcsv,csvtocsv,fast,fuv,splitcsv,"/>
> </copy>
> </target>
> <target name="test" depends="init,compiletst" description="test">
> <java classname="com.ediidea.mappingtools.MappingToolsTestCase"
> failonerror="true" fork="true">
> <classpath>
> <pathelement location="${ant.home}/lib/xercesImpl.jar"/>
> <pathelement location="lib/xalan.jar"/>
> <pathelement location="lib/ostermillerutils_1_02_21.jar"/>
> <pathelement location="${junit.jar}"/>
> <pathelement location="build/classes/srcobj"/>
> <pathelement location="build/classes/tstobj"/>
> </classpath>
> </java>
> </target>
> <target name="testjar" depends="init,jar,compiletst" description="test
> jar">
> <java classname="com.ediidea.mappingtools.MappingToolsTestCase"
> failonerror="true" fork="true">
> <classpath>
> <pathelement location="${ant.home}/lib/xercesImpl.jar"/>
> <pathelement location="lib/xalan.jar"/>
> <pathelement location="lib/ostermillerutils_1_02_21.jar"/>
> <pathelement location="${junit.jar}"/>
> <pathelement location="build/lib/mappingtools.jar"/>
> <pathelement location="build/classes/tstobj"/>
> </classpath>
> </java>
> </target>
> <target name="junit" depends="init,jar,compiletst" description="test jar
> using junit">
> <junit printsummary="true" haltonfailure="true">
> <formatter type="plain" usefile="false"/>
> <test name="com.ediidea.mappingtools.MappingToolsTestCase"/>
> <classpath>
> <pathelement location="lib/xalan.jar"/>
> <pathelement location="lib/ostermillerutils_1_02_21.jar"/>
> <pathelement location="build/lib/mappingtools.jar"/>
> <pathelement location="build/classes/tstobj"/>
> </classpath>
> </junit>
> </target>
> <target name="javadoc" depends="init" description="javadoc">
> <mkdir dir="doc/apidoc"/>
> <javadoc destdir="doc/apidoc" packagenames="com.ediidea.mappingtools.*">
> <sourcepath>
> <pathelement location="src"/>
> </sourcepath>
> <classpath>
> <pathelement location="${junit.jar}"/>
> <pathelement location="lib/xalan.jar"/>
> <pathelement location="lib/ostermillerutils_1_02_21.jar"/>
> <pathelement location="build/classes/srcobj"/>
> </classpath>
> </javadoc>
> </target>
> </project>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03136 seconds