selenium+jenkins+maven+testNG搭建持续集成环境

为了简明起见,分几大部分,很基础的细节就不详述了java

一·安装jenkinsapache

二·建立一个maven项目的jobwindows

  2.1   填上SVN的Repository URLmaven

  2.2  因为是在本地执行maven命令,因此添加构建步骤:Execute windows batch commandide

     写入如下命令(注意须要在pom.xml文件中加上maven的插件,pom.xml文件在后面)测试

    cd D:\Program Files (x86)\Jenkins\workspace\ZZTHaiWaiGouKeZhiFu.java
      mvn install
    mvn Suite.xmlui

三·url

 

 ---------------------------------------------分割线----------------------------------------spa

 

<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
相关文章
相关标签/搜索