我有硒測試框架,早些時候我們有用於啓動和停止硒網格的xml文件,因爲它用來反映測試報告,我們已經刪除了用於啓動和停止網格的xml並傾向於使用螞蟻爲此,因此我試圖創建一個需要參數並傳遞給java函數的目標。如何創建一個接受參數的螞蟻目標
我的功能 -
public static void main(String[] args) throws Exception {
if(args.length<1){
System.err.println("This execution requires arguments such as startGRID or stopGRID");
log.error("This execution requires argumentr such as startGRID or stopGRID");
} else if(args[0].equalsIgnoreCase("startGRID")){
System.out.println("Starting up GRID");
log.info("Starting up GRID");
setupSeleniumGrid();
} else if(args[0].equalsIgnoreCase("stopGRID")){
System.out.println("Shutting down GRID");
log.info("Shutting down GRID");
shutdownSeleniumGrid();
}else {
System.err.println("unrecognized arguments, please provide aruments such as startGRID or stopGRID");
log.error("unrecognized arguments, please provide aruments such as startGRID or stopGRID");
}
}
Ant目標 -
<!-- start Grid -->
<target name="startGRID" depends="compile">
<echo>
Please wait .... GRID is starting up...
</echo>
<java classname="foo.bar.framework.selenium.SetupGrid" classpath="${test.dest}" classpathref="${test.c}" />
<echo>
GRID Start up complete !
</echo>
</target>
上述目標
我不知道classpathref="${test.c}
做什麼,因爲它是在傳統的代碼,我們正在不斷地使用它。
如果有人可以建議工作目標通過ant完成此任務。
可能重複[使用Ant運行命令行參數的程序] (http://stackoverflow.com/questions/3730880/use-ant-for-running-program-with-command-line-arguments) – sudocode 2015-02-11 12:34:05