Maven完成surefire-report,包括通过测试记录事件

问题描述 投票:1回答:2

我想使用maven的surefire-report插件生成一个报告,它将为我提供所有测试的详细报告,这些测试与每次测试运行期间记录的日志事件一起运行,而不仅仅是我的测试失败的事件。这也将为我提供测试失败的完整背景。

这是我的pom.xml文件:

        <artifactId>SampleTests</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>sampleTests</name>
<url>http://maven.apache.org</url>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>2.11</version>
        <type>maven-plugin</type>
    </dependency>
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20090211</version>
    </dependency>
</dependencies> 
<build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <outputDirectory>${basedir}/target/classes</outputDirectory>
    <testSourceDirectory>src/main/test</testSourceDirectory>
    <testOutputDirectory>${basedir}/target/test-classes</testOutputDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.4.2</version>
        <configuration>
          <includes>
            <include>com/mypackage/**</include>
          </includes>
          <test>**/*Tests</test>
        </configuration>
      </plugin>
      <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
        </plugin>
    </plugins>
</build>
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>2.6</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>report-only</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>
</project>

我使用mvn surefire-report:report来生成报告。所以我想知道我是否还有其他任何可以做的事情,以便查看测试过程中发生的事情的详细报告?

maven junit report maven-plugin maven-surefire-plugin
2个回答
© www.soinside.com 2019 - 2024. All rights reserved.