我有大量的junits,運行它們都需要很長時間。但CPU和內存利用率只有30%左右。我不能在同一個jvm中的並行線程中運行junit,因爲它們不是線程安全的並且不可能修復它們。 據我所知junit螞蟻任務開始分開jvm來運行junit。 是否有可能從螞蟻運行幾個jvms?我認爲這樣的解決方案可以顯着縮短執行時間在螞蟻的兩個jvms中運行junit
目前,我在螞蟻使用這樣的代碼運行它們:
<for param="bundle" keepgoing="true">
<path>
<dirset dir="${testdir}/plugins">
<depth max="0"/>
</dirset>
</path>
<sequential>
<echo message="Running tests in bundle @{bundle}"/>
<junit outputtoformatters="no" printsummary="yes" failureproperty="test.failed" maxmemory="512m" fork="yes" forkmode="once">
<classpath>
<path refid="tests.classpath" />
</classpath>
<formatter type="xml" />
<batchtest todir="${junit.result.dir}">
<fileset dir="@{bundle}/src">
<patternset refid="test.sources" />
</fileset>
</batchtest>
</junit>
</sequential>
不[本博客文章(http://blog.code-cop.org/2009/09/parallel- junit.html)描述你在做什麼? –