2016-06-09 23 views
0

我需要並行啓動testng類並在兩個不同的JVM實例中啓動。我正嘗試使用ant並行任務來實現這一目標,但不成功。通過下面的塊,它會按順序啓動兩個測試任務,而不是並行執行。你能幫我解決這個問題嗎?在不同JVM上並行運行testng任務

<parallel threadCount="1"> 
    <testng classpathref="maven.test.classpath" outputdir="target/first"> 
     <classfileset dir="build"> 
     <include name="**/TestX.class" /> 
     </classfileset> 
     <jvmarg line="${java.args}" /> 
     <jvmarg line="${run.args}" /> 
    </testng> 
    <testng classpathref="maven.test.classpath" outputdir="target/second"> 
     <classfileset dir="build"> 
     <include name="**/TestY.class" /> 
     </classfileset> 
     <jvmarg line="${java.args}" /> 
     <jvmarg line="${run.args}" /> 
    </testng> 
</parallel> 
+0

你想通過增加'threadCount'屬性值來試試看嗎? – Rao

+0

nope,那也沒有工作:( – Kedarnath

+0

可能你可以檢查示例[這裏](http://www.avajava.com/tutorials/lessons/how-do-i-use-the-parallel-task.html) – Rao

回答

0

根據TestNG任務文檔,它總是以fork模式運行(從Ant單獨的JVM中讀取)。所以,我認爲threadCount="1"可能是順序執行的原因。

+0

感謝您的回覆,不幸的是這沒有影響! – Kedarnath