【发布时间】:2015-02-09 22:22:36
【问题描述】:
我有 selenium testng 框架,之前我们有用于启动和停止 selenium 网格的 xml 文件,因为它曾经反映在测试报告中,我们已经删除了用于启动和停止网格的 xml,并倾向于使用 ant 来实现这一点,因此我正在尝试创建一个接受参数并传递给 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");
}
}
蚂蚁目标 -
<!-- 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 完成此任务的工作目标。
【问题讨论】: