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
相關文章
相關標籤/搜索