You have the right idea:  Just put the .jar file in the class path of
your test runnning task.

<target name="runtests" depends="compiletests" if="junit.present">
        <java fork="yes" classname="junit.textui.TestRunner"
taskname="junit" failonerror="true">
            <arg value="com.flat5software.AllJUnitTests"/>
            <classpath>
                <pathelement location="path/to/jar/file.jar" />
                <pathelement location="${build.testcases}" />
                <pathelement path="${java.class.path}" />
            </classpath>
        </java>
    </target>

On Mon, 2004-11-08 at 12:52, Michael W. Taft wrote:
> Hello -
> I'm new to this group and just as new to using JUnit. While I am able to
> create and execute simple test cases, what I am really looking to do is
> to test my classes in their real-world environment: packaged in jar files.
>
> I'm unclear, however, how to do this. If I run an Ant build, and create
> a jar file with all the classes in it (as I always do), how do I then
> run the jUnit tests against the classes in this .jar?
>
> I suspect it has something to do with making adding a jUnit task to the
> Ant build file that contains a "java -cp..." style command pointing to
> the files in the jar? Is this the right way to go? Does anyone have a
> sample build file that does this?
>
> Thanks for any help. I look forward to improving my code using unit tests.
> M.
>
>
>
>
>
>

> Yahoo! Groups Links
>
>
>

>
>
>





Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=:HM/A=2128215/rand=839492363


Yahoo! Groups Links

Reply via email to