之前我使用build.xml(ant)來運行測試用例,但現在我使用pom.xml(maven)來運行測試用例。
當我有螞蟻時,我能夠得到testng-xslt報告,但在閱讀了許多博客和教程後,我無法通過pom生成。我想調查是什麼區別,我看到我的類路徑中有saxon.jar,但是它在pom.xml中缺少,因此我添加了依賴關係。第二件事,我注意到我沒有在pom.xml中指定.xml路徑(我不知道在pom中將它添加到哪裏)。 我在這裏同時提供了pom.xml和build.xml,請看看兩者,並讓我知道我錯過了什麼,以通過pom.xml生成testng-xslt報告,但它存在於build.xml中,我如何能解決該問題。
的build.xml「通過build.xml生成報告」和「通過pom.xml生成」有什麼區別?
<target name="testng-xslt-report">
<delete dir="${basedir}/testng-xslt">
</delete>
<mkdir dir="${basedir}/testng-xslt">
</mkdir>
<xslt in="${basedir}/test-output/testng-results.xml" style="${basedir}/testng-results.xsl" out="${basedir}/testng-xslt/index.html">
<param expression="${basedir}/testng-xslt/" name="testNgXslt.outputDir" />
<param expression="true" name="testNgXslt.sortTestCaseLinks" />
<param expression="FAIL,SKIP,PASS,CONF,BY_CLASS" name="testNgXslt.testDetailsFilter" />
<param expression="true" name="testNgXslt.showRuntimeTotals" />
<classpath location="D:\automation\windowsproject\zookeeper\lib\saxon-8.7.jar">
</classpath>
</xslt>
</target>
的pom.xml
<build>
<testResources>
<testResource>
<directory>src/test/resource</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>
C:/Users/windowspc/workspace/windows-project/Chrome.xml
</suiteXmlFile>
</suiteXmlFiles>
<testFailureIgnore>
true
</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.testng.xslt</groupId>
<artifactId>testng-xslt-plugin</artifactId>
<version>1.1</version>
<configuration>
<outputDir>C:/Users/windowspc/workspace/windows-project/target/testng-xslt-report</outputDir>
<showRuntimeTotals>true</showRuntimeTotals>
<sortTestCaseLinks>true</sortTestCaseLinks>
<testDetailsFilter>FAIL,PASS,SKIP,CONF</testDetailsFilter>
</configuration>
</plugin>
</plugins>
</reporting>
<pluginRepositories>
<pluginRepository>
<id>testng-xslt-plugin</id>
<url>http://uhftopic.com/maven/</url>
</pluginRepository>
</pluginRepositories>
...
...
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.12</version>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>saxon</artifactId>
<version>8.7</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.5.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>