0

I have written a Selenium Junit test case (say a1.java). There is another java program say a2.java which reads a spreadsheet for different config related values and it sets these values into member variables of a1.java. So a2.java runs main program a1.java many times. To get the test report, I have created ant build file (build.xml).

Is there some way to write some java code to execute my build file? Note I am using Ant version (1.8.3.v20120321-1730) for this purpose.

I saw somewhere to use org.apache.tools.ant.Project but its not working. Any help in this regard please.

user419534
  • 635
  • 2
  • 8
  • 14

1 Answers1

1

I think the simplest solution is to call org.apache.tools.ant.Main#main just like the ant command line does.

For instance:

Main.main(new String[] { "-f", "path/to/the/build.xml"});
Nicolas Lalevée
  • 2,014
  • 1
  • 15
  • 14