无法在Maven中使用reportNG生成HTML报告

时间:2014-02-11 03:57:51

标签: maven reportng

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0          
http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.operations.dashboard</groupId>
<artifactId>dashboard</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>DashboardAutomationProject</name>
<description>This automates the dashboard application</description>
<dependencies>
  <dependency>
     <groupId>org.seleniumhq.selenium</groupId>
     <artifactId>selenium-java</artifactId>
     <version>2.39.0</version>
  </dependency>
  <dependency>
     <groupId>org.testng</groupId>
     <artifactId>testng</artifactId>
     <version>6.8.7</version>
  </dependency>
  <dependency>
     <groupId>org.uncommons</groupId>
     <artifactId>reportng</artifactId>
     <version>1.1.4</version>
  </dependency>
  <dependency>
     <groupId>com.google.inject</groupId>
     <artifactId>guice</artifactId>
     <version>3.0</version>
  </dependency>
</dependencies>
<build>
  <sourceDirectory>src</sourceDirectory>
  <plugins>
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.14.1</version>
        <configuration>
           <properties>
              <property>
                 <name>usedefaultlisteners</name>
                 <value>false</value>
              </property>
              <property>
                 <name>listener</name>
                 <value>org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter</value>
              </property>
           </properties>
           <suitexmlfiles>
              <suitexmlfile>testng.xml</suitexmlfile>
           </suitexmlfiles>
        </configuration>
     </plugin>
     <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
           <encoding>iso-8859-1</encoding>
           <source>1.7</source>
           <target>1.7</target>
        </configuration>
     </plugin>
  </plugins>
</build>
<reporting>
  <plugins>
     <!--TestNG-xslt related configuration.-->
     <plugin>
        <groupId>org.reportyng</groupId>
        <artifactId>reporty-ng</artifactId>
        <version>1.2</version>
        <configuration>
           <!--Output directory for the testng xslt report-->
           <outputdir>/target/testng-xslt-report</outputdir>
           <sorttestcaselinks>true</sorttestcaselinks>
           <testdetailsfilter>FAIL,SKIP,PASS,CONF,BY_CLASS</testdetailsfilter>
           <showruntimetotals>true</showruntimetotals>
        </configuration>
     </plugin>
  </plugins>
</reporting>
<pluginRepositories>
  <pluginRepository>
     <id>reporty-ng</id>
     <url>https://github.com/cosminaru/reporty-ng/raw/master/dist/maven</url>
  </pluginRepository>
</pluginRepositories>
</project>

大家好,

我已经创建了一个Maven项目来自动化webportal并拥有上面的POM.xml,其中我添加了TestNG和ReportNG的所有依赖项。

但我无法创建ReportNG报告。 通常,应该在test-output文件夹中创建一个HTML文件夹,该文件夹在eclipse浏览器中提供HTML报告。

有人可以帮帮我吗?不确定这里输入的代码是什么错误

1 个答案:

答案 0 :(得分:2)

希望这仍然有用。 ReportNG,从1.1.4开始需要依赖com.google.inject:guice:3.0