我有硒测试框架,早些时候我们有用于启动和停止硒网格的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