1. What is Ant?
is a tool that links software compilation, testing, deployment, and other steps together to automate
2. Download and install
Http://www.cnblogs.com/yuzhongwusan/archive/2013/03/26/2982411.html
3, the use in the ECLIPCE
Preparatory work:
Project Right-click--new--folder--folder name:lib
Put Testng-6.8.5.jar, Jcommander.jar into Lib
Project Right--new--file--build.xml (file name cannot be written incorrectly)
Put code
<?XML version= "1.0" encoding= "UTF-8"?><Projectname= "HelloWorld"default= "Regression"Basedir=".">< Propertyname= "src"value= "src"/>< Propertyname= "Dest"value= "Classes"/>< Propertyname= "Testng.dir"value= "${basedir}\lib"/>< Propertyname= "Testng.output.dir"value= "${basedir}\test-output"/> <PathID= "Class1"> <Filesetdir= "${basedir}\lib"includes= "*jar"/> <pathelement Location= "${dest}"/> <pathelement Location= "${src}"/> </Path><TaskdefResource= "Testngtasks"Classpath= "${testng.dir}/testng-6.8.5.jar"/><Targetname= "Init"> <Deletedir= "${dest}"/> <mkdirdir= "${dest}"/></Target><Targetname= "Compile"depends= "Init"> <JavacSrcdir= "${src}"Destdir= "${dest}"Classpathref= "Class1"encoding= "UTF8"Includeantruntime= "Off"Debug= "On"DebugLevel= "Lines,vars,source"/></Target><Targetname= "Regression"depends= "Compile"> <Echo>Running testng</Echo> <testngOutputDir= "${testng.output.dir}"Classpathref= "Class1"delegatecommandsystemproperties= "true"> <Xmlfilesetdir= "${basedir}"includes= "Testng.xml"/> </testng></Target></Project>
4. Running Build.xml
You can right-click Run As--ant Build
You can also use CMD to enter the directory where the Build.xml is located, using the Ant command
Interface Test (java+testng+ant+jenkins) third article ant