java如何获取html格式的Maven报告?
我有一个带有eclipse的maven项目和一些selenium测试。 我可以在命令行中运行它们,并在目标文件夹中以txt和xml格式获得报告
但是我想要html格式的报告。 我应该在POM文件中添加什么
多谢各位
这是我的POM。xml
....
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.44.0</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.3</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
# 1 楼答案
参见this question,正如第二个答案所指出的,您应该能够使用Maven Surefire Report plugin
“Surefire报告插件解析${basedir}/target/Surefire报告下生成的TEST-*.xml文件,并使用DOXIA呈现这些文件,DOXIA将创建测试结果的web界面版本。”
以下是配置它的XML:
以下任一命令都将调用它:
mvn site
mvn surefire-report:report