1, install Jdk7 above
2, Http://mirrors.jenkins-ci.org/windows/latest Download the latest war package
3, cmd command in the War package Directory execution: Java-jar Jenkins.war
4. Enter http://localhost:8080 to open the Jenkins page
5, install TORTOISESVN, new file, open the space right after tortoisesvn--create repository here, get SVN directory
File:///D:/test/jenkins/test
6. After opening the SVN directory, copy the Eclipse project directly into the project and right-click on the SVN commint submit
7. Install ant, configure environment variables Ant_home d:/apache-ant-1.9.0 path d:/apache-ant-1.9.0/bin classpath
D:/apache-ant-1.9.0/lib
8. Ant Authentication: win+r--cmd Enter the following command: Ant
If the following appears, the installation is successful:
Buildfile:build.xml does not exist!
Build failed
Description ant installation is successful!
9. Open http://localhost:8080 and create the first free-style project in Jenkins
10. Select Subversion in source management, enter project path: File:///D:/test/jenkins/test/testjenkins
11. Choose Execute Windows in the build ... Enter Ant
12, save, immediately build
Corresponding Build.xml and testng.xml of the project
Build.xml
If the project is purely compiled, default is set to compile;
<?XML version= "1.0" encoding= "UTF-8"?><!--Hello is the project name, TestNG is the name of the last target -<Projectname= "Hello"default= "TestNG"Basedir="."> <!--Imported External Packages - <Targetname= "External package"> <Echomessage= "First step to configure the external package"/>
<!--<taskdef resource= "testngtasks" classpath= "Lib/testng-5.12.jar"/> - <TaskdefResource= "Testngtasks"> <Classpath> <pathelement Location= "Lib/testng-5.12.jar" /> </Classpath> </Taskdef> </Target> <!--source File - <Targetname= "source"depends= "External package"> <Echomessage= "Second Step configuration source file"/> < Propertyname= "Srcdir" Location= "src" /> < Propertyname= "Libdir" Location= "Lib" /> < Propertyname= "Full-compile"value= "true" /> </Target> <!--Path - <Targetname= "path"depends= "source"> <Echomessage= "Third Step configuration classpath path"/> <PathID= "Classpath.base" /> <PathID= "Classpath.test"> <Filesetdir= "${libdir}"> <includename= "**/*.jar" /> </Fileset> <!--<pathelement location= "test"/> - <pathelement Location= "${srcdir}" /> <PathrefID= "Classpath.base" /> </Path> </Target> <!--Clean up - <Targetname= "clean"depends= "path"> <Echomessage= "Fourth step configuration Cleanup"/> <Deleteverbose= "${full-compile}"> <Filesetdir= "${srcdir}"includes= "**/*.class" /> </Delete> </Target> <!--compiling - <Targetname= "Compile"depends= "clean"> <Echomessage= "Fifth Step configuration compilation"/> <JavacSrcdir= "${srcdir}"Destdir= "${srcdir}"verbose= "${full-compile}"Includeantruntime= "false"> <ClasspathrefID= "Classpath.test" /> </Javac> </Target> <!--testng Automated Testing - <Targetname= "TestNG"depends= "Compile"> <Echomessage= "Sixth step configuration Automation test"/> <!--testoutput test result is the output path - <testngOutputDir= "Testoutput"Classpathref= "Classpath.test"> <!--testng.xml configuration in src directory - <Xmlfilesetdir= "${srcdir}"includes= "Testng.xml" /> </testng> </Target></Project>
Testng.xml
<?XML version= "1.0" encoding= "UTF-8"?><!DOCTYPE Suite SYSTEM "Http://testng.org/testng-1.0.dtd"><Suitename= "Default Suite"Preserve-order= "true"> <TestPreserve-order= "true"name= "Baidutest"> <Classes> <!--Package name + class name - <classname= "Test.complexcalculationtest"> <Methods> <!--Method Name - <includename= "Divisiontest"/> <includename= "Multiplytest"/> </Methods> </class> <classname= "Test. Simplecalculationtest "> <Methods> <includename= "Addtest"/> <includename= "Subtrationtest"/> </Methods> </class> </Classes> </Test> </Suite>
Java+jenkins+testng+selenium+ant