0
votes

From the title I've put the question can seem very obvious... but it isn't (for me anyway)

I have 2 very simple questions. When you run a junit test and you have to specify the the name i.e.

<junit>
<test name="my.single.test"/>
</junit>

Does it match the path against the src folder(therefore java classes)?

Is there a way of running Junit from a jar? For example, I export all the test into a jar and I want to be able to run those test within the junit task. I know you can use < batchtest> and < fileset> (combined), but I think it works only for .java files, doesn't it?

2

2 Answers

3
votes

All you need is to specify proper classpaths. See the example http://ideoplex.com/id/25/ant-and-junit

3
votes
<junit>
    <classpath> 
        <fileset dir="yourLibDir">
          <include name="**/your.jar"/><!--my.single.test in your.jar-->
        </fileset>
    </classpath>
    <test name="my.single.test"/>
</junit>