2017-09-06 134 views
0

我用蚂蚁JUnit来为我的单元测试报告,因此可以说,我有一个单元测试,称为userServiceTest所以在my build.xml文件我把以下内容:如何自动生成新的单元测试蚂蚁报告

<target name="UserServiceTest"> 
     <mkdir dir="${junit.output.dir}" /> 
     <junit fork="yes" printsummary="withOutAndErr"> 
      <formatter type="xml" /> 
      <test name="webapp.service.UserServiceTest" todir="${junit.output.dir}" /> 
      <jvmarg line="-ea" /> 
      <classpath refid="Web Application.classpath" /> 
     </junit> 
    </target> 

现在我们可以说我已经添加了一个名为productServiceTest的新单元测试类,是否可以将这个新的单元测试自动包含在我的报告中?

预先感谢您。

回答

2

尝试<batchtest>,而不是<test>

<target name="UserServiceTest"> 
     <mkdir dir="${junit.output.dir}" /> 
     <junit fork="yes" printsummary="withOutAndErr"> 
      <formatter type="xml" /> 
      <batchtest fork="yes" todir="${junit.output.dir}"> 
       <fileset dir="${src.tests}"> 
         <include name="webapp.service.*ServiceTest"/> 
        </fileset> 
      </batchtest> 
      <jvmarg line="-ea" /> 
      <classpath refid="Web Application.classpath" /> 
     </junit> 
</target>