2017-09-06 131 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>