Maven 2 在测试阶段生成html surefire测试html输出
我不确定这是否是一个简单的问题,但我希望surefire在测试阶段生成html格式的输出文件(除了xml和txt格式的输出文件之外) 我试图通过为build>surefire添加一个“executions”条目来实现这一点。这是正确的位置吗?如果是,我做错了吗Maven 2 在测试阶段生成html surefire测试html输出,maven-2,surefire,Maven 2,Surefire,我不确定这是否是一个简单的问题,但我希望surefire在测试阶段生成html格式的输出文件(除了xml和txt格式的输出文件之外) 我试图通过为build>surefire添加一个“executions”条目来实现这一点。这是正确的位置吗?如果是,我做错了吗 <build> .. <plugins> .. <plugin> <groupId>org.apache.maven.plugins&
<build>
..
<plugins>
..
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.6</version>
<configuration>
<outputDirectory>site</outputDirectory>
</configuration>
<executions>
<execution>
<id>during-tests</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
..
..
org.apache.maven.plugins
maven surefire报告插件
2.6
网站
测试期间
测试
报告
我希望surefire在测试阶段生成html格式的输出文件(除了xml和txt格式的输出文件之外)
最简单的方法(不运行站点
)可能是调用:
mvn surefire-report:report
这将在生成报告之前运行测试(但结果不是很好,因为不会生成CSS,因此必须运行site
)
我试图通过为build>surefire添加一个“executions”条目来实现这一点。这是正确的位置吗?如果是,我做错了吗
<build>
..
<plugins>
..
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.6</version>
<configuration>
<outputDirectory>site</outputDirectory>
</configuration>
<executions>
<execution>
<id>during-tests</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
如果您真的想将surefire报告
插件绑定到测试
阶段,我的建议是只使用报告
目标(因为它不会重新运行测试,请参见),如下所示:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>report-only</goal>
</goals>
</execution>
</executions>
</plugin>
看起来没有那么慢(我使用的是Maven 3,仅此报告),并且产生了更好的结果。但是,如果您有一个复杂的站点设置,这可能不是一个选项(至少在不引入概要文件使事情变得更复杂的情况下)
相关问题
mvn test site