2017-02-24 93 views
0

基本上,如果測試花費超過2分鐘中止特定的測試,並繼續與其他人,我有這片如何限制測試時間執行從構建XML文件

<junit printsummary="yes" haltonfailure="no" haltonerror="no"> 
     <classpath> 
     <pathelement path="${build.test}"/> 
     <path refid="project.class.path" /> 
     </classpath> 
     <formatter type="plain" usefile="no"/> 
     <batchtest fork="yes" haltonfailure="no" haltonerror="no" failureproperty="test.failed" todir="../src/result"> 
     <fileset dir="${build.test}"> 
      <include name="**/app/**/*Test.*"/> 
      <exclude name="**/app/**/*Helper*"/> 
</fileset> 
     </batchtest> 
    </junit> 

回答

1

junit ant doc,你有timeout屬性:

超時 - 取消單個測試,如果他們沒有在規定的時間 (以毫秒計)完成。如果fork被禁用,則忽略。在同一個Java VM中運行 多個測試(請參閱forkMode)時,超時應用 到所有測試一起使用的時間,而不是單個測試。

<junit fork="yes" timeout="60000" > 

如果forkmode設置爲perTest默認的超時值是每個單獨測試,但如果指定forkmodeonce,單個JVM將運行所有測試和值適用於所有的測試。

相關問題