2016-06-09 66 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