從 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