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 | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/junit/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
