开发者

Running Junit task in Ant

开发者 https://www.devze.com 2023-03-20 06:46 出处:网络
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.

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.sin开发者_如何学Pythongle.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?


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


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

精彩评论

暂无评论...
验证码 换一张
取 消