Webdriver+testNG+ReportNG+Maven+SVN+Jenkins自動化測試框架的pom.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.main.stuty</groupId>
<artifactId>web-driver</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>web-driver</name>
<url>http://maven.apache.org</url>

<!-- maven 參數配置,這里引用不同的testng.xml -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- 解決控制台輸出亂碼問題 -->
<argLine>-Dfile.encoding=UTF-8</argLine>
<xmlFileName>testng.xml</xmlFileName>
</properties>


<!-- maven 引用依賴不同的jar -->
<dependencies>

<!-- 依賴testNg -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
<!-- 避免編譯時提示jar包依賴找不到的問題-->
<!-- <scope>test</scope> -->
</dependency>

<!-- 依賴reportNg 關聯testNg -->
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.4</version>
<scope>test</scope>

<!-- 此處排除了testng,因為reportNg中本身就有testng的jar包依賴-->
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- 依賴Guice -->
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>

<!-- 依賴Selenium驅動包 -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
<scope>compile</scope>
<!-- scope標簽中對應值的解釋: * compile,缺省值,適用於所有階段,會隨着項目一起發布。 * provided,類似 compile,期望
JDK、容器或使用者會提供這個依賴。如 servlet.jar。 * runtime,只在運行時使用,如 JDBC 驅動,適用運行和測試階段。 *
test,只在測試時使用,用於編譯和運行測試代碼。不會隨項目發布。 * system,類似 provided,需要顯式提供包含依賴的 jar, Maven
不會在 Repository 中查找它。 -->
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
</dependencies>

 


<build>
<plugins>
<!-- 添加插件maven-surefire-plugin(用來在maven構建生命周期的test phase執行一個應用的單元測試), 關聯testNg.xml,添加ReportNg的監聽器,修改最后的TestNg的報告 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>res/${xmlFileName}</suiteXmlFile>
</suiteXmlFiles>
<!-- <systemPropertyVariables>標簽設置為false為了讓log中的html在頁面上正常顯示,避免直接顯示為html字符串 -->
<systemPropertyVariables>
<org.uncommons.reportng.escape-output>false</org.uncommons.reportng.escape-output>
</systemPropertyVariables>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>false</value>
</property>
<property>
<name>listener</name>
<value>org.uncommons.reportng.HTMLReporter</value>
</property>
</properties>
<workingDirectory>target/</workingDirectory>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>

</plugins>
</build>
</project>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM