从 ant 传递 testng 命令行参数
当使用 Ant 调用 testng 任务时,如何动态传递 testng 命令行参数。
Below is the sample section of testng task target defined in Ant build.xml file:
<target name="runTest" depends="compile">
<testng classpath="${cp}:${build.dir}" groups="${groups}">
<xmlfileset dir="${basedir}" includes="testng.xml"></xmlfileset>
</testng>
</target>
Then from command line, by using the jvmarg properties, you can provide the value of "groups" (which is a standard testng command line attribute) dynamically like this:
$ ant runTest -Dgroups group1,group2,...,groupN
Above is equivalent to invoking testng from command line using java:
$ java org.testng.TestNG -groups group1,group2,...,groupN testng.xml