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