Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven完整的surefire报告,包括通过的测试记录事件_Maven_Junit_Report_Maven Plugin_Maven Surefire Plugin - Fatal编程技术网

Maven完整的surefire报告,包括通过的测试记录事件

Maven完整的surefire报告,包括通过的测试记录事件,maven,junit,report,maven-plugin,maven-surefire-plugin,Maven,Junit,Report,Maven Plugin,Maven Surefire Plugin,我想使用maven的surefire report插件生成一个报告,它将为我提供所有测试的详细报告,这些测试在每次测试运行期间都会记录日志事件,而不仅仅是测试失败的事件。这也将为我提供测试失败的完整上下文 这是我的pom.xml文件: <artifactId>SampleTests</artifactId> <version>1.0</version> <packaging>jar</packaging> &

我想使用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生成报告。 因此,我想知道我是否可以做其他事情,以便查看测试运行期间发生的详细报告?

作为

将测试结果报告生成为HTML格式。 此目标不运行测试,只生成报告


你只是在尝试报告。尝试另一个报告作为目标

我最终使用ant实现了我所需要的。感谢这个博客:


如果您想获得所有测试事件的详细报告,请使用此

仅报告和您所说的报告仅用于定义是否运行测试。它与测试中的日志事件无关。我想实现的是,我看到了运行期间发生的事件的完整日志,您在报告中运行mvn surefire report:report from cmd printer时会看到这些事件。但是,当您使用sure fire插件构建项目时,默认情况下,这种报告会出现在目标文件夹中。恐怕你没有检查。我不确定这是否是您所需要的,带有surefire的Maven jxr插件。它打印测试用例失败的源代码参考。OP请求maven帮助,这篇文章谈论ant,没有帮助。我相信这篇文章是OP。