为了简明起见,分几大部分,很基础的细节就不详述了
一·安装jenkins
二·创建一个maven项目的job
2.1 填上SVN的Repository URL
2.2 由于是在本地执行maven命令,所以添加构建步骤:Execute windows batch command
写入以下命令(注意需要在pom.xml文件中加上maven的插件,pom.xml文件在后面)
cd D:\Program Files (x86)\Jenkins\workspace\ZZTHaiWaiGouKeZhiFu.java
mvn install
mvn Suite.xml
三·
---------------------------------------------分割线----------------------------------------
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.zzt.test</groupId> <artifactId>Test</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>Test</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <pluginRepositories> <pluginRepository> <id>apache.snapshots</id> <url> http://people.apache.org/repo/m2-snapshot-repository/ </url> </pluginRepository> </pluginRepositories> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <!--添加selenium依赖 https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java --> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>2.44.0</version> </dependency> <!--添加TestNG依赖 --> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.9.10</version> </dependency> </dependencies> <!-- 添加maven插件 --> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <suiteXmlFiles> <suiteXmlFile>Suite.xml</suiteXmlFile> <!-- 此处写上需要执行的TestNG测试套件 --> </suiteXmlFiles> </configuration> <version>2.5</version> </plugin> </plugins> </build> </project>
pom.xml
原文地址:https://www.cnblogs.com/gcgc/p/5624696.html
时间: 2024-10-10 13:34:51