I have selenium testng framework, earlier we had xml files for starting and stopping the selenium grid, since it used to reflect in test reports we have removed the xmls for starting and stopping the grid and tend to use ant for this, hence I am trying to create a target which takes arguments and passes on to java function.
my function -
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 target -
<!-- 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>
in above target I am not sure what classpathref="${test.c}
does as it is in the legacy code and we are continuously using it.
Please if somebody can suggest working target to accomplish this task via ant.