maven surefire 插件报告为空
maven sure-fire plugin report empty
我的要求是通过 maven 运行 多个 SOAPUI 测试用例,使用 jenkins 自动构建它并生成测试结果报告。
除了最后一部分,我已经成功完成了。
现在我想生成所有测试用例结果的 html 报告。
我使用 maven-surefire-report-plugin 来做到这一点。
我已关注这篇文章
http://maven.apache.org/surefire/maven-surefire-report-plugin/usage.html
测试用例成功,报告生成成功,但报告中没有任何记录。
我在这里遗漏了什么吗?是否有任何配置参数来设置生成报告或其他东西的源路径?
surefire 报告在 ${project.build.directory}/site 文件夹中生成。
SOAPUI 测试用例的输出文件在 ${project.build.directory}/reports 文件夹中生成。
这是我写的pom.xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>soapTest</groupId>
<artifactId>soapTest</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven 2 SoapUI Sample</name>
<url>http://maven.apache.org</url>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>5.1.2</version>
<configuration>
<projectFile>soapui-project.xml</projectFile>
<outputFolder>${project.build.directory}/test-classes</outputFolder>
<junitReport>true</junitReport>
<exportAll>true</exportAll>
<printReport>true</printReport>
<testSuite>Authenticate</testSuite>
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.7.2</version>
</plugin>
</plugins>
</reporting>
Maven Surefire 报告插件的第一行 Introduction 说:
The Surefire Report Plugin parses the generated TEST-*.xml
files under ${basedir}/target/surefire-reports
...
因此,如果您将 soapui-maven-plugin 更改为:
<outputFolder>${basedir}/target/surefire-reports</outputFolder>
应该可以。
还有 additional instructions 如何更改 maven-surefire-report-plugin 的默认位置。
示例 pom.xml,其中还使用 mvn site 命令创建了报告。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.smartbear.samples</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven 2 SoapUI Sample</name>
<url>http://maven.apache.org</url>
<pluginRepositories>
<pluginRepository>
<id>smartbear-sweden-plugin-repository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>5.3.0</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectFile>globalweather-soapui-project.xml</projectFile>
<junitReport>true</junitReport>
<outputFolder>${basedir}/target/surefire-reports</outputFolder>
<printReport>true</printReport>
<exportAll>true</exportAll>
<globalProperties>
<value>ENV=DEV</value>
</globalProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>2.1</version>
<configuration>
<outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
我的要求是通过 maven 运行 多个 SOAPUI 测试用例,使用 jenkins 自动构建它并生成测试结果报告。 除了最后一部分,我已经成功完成了。
现在我想生成所有测试用例结果的 html 报告。 我使用 maven-surefire-report-plugin 来做到这一点。
我已关注这篇文章 http://maven.apache.org/surefire/maven-surefire-report-plugin/usage.html 测试用例成功,报告生成成功,但报告中没有任何记录。
我在这里遗漏了什么吗?是否有任何配置参数来设置生成报告或其他东西的源路径?
surefire 报告在 ${project.build.directory}/site 文件夹中生成。 SOAPUI 测试用例的输出文件在 ${project.build.directory}/reports 文件夹中生成。
这是我写的pom.xml
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>soapTest</groupId>
<artifactId>soapTest</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven 2 SoapUI Sample</name>
<url>http://maven.apache.org</url>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>5.1.2</version>
<configuration>
<projectFile>soapui-project.xml</projectFile>
<outputFolder>${project.build.directory}/test-classes</outputFolder>
<junitReport>true</junitReport>
<exportAll>true</exportAll>
<printReport>true</printReport>
<testSuite>Authenticate</testSuite>
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.7.2</version>
</plugin>
</plugins>
</reporting>
Maven Surefire 报告插件的第一行 Introduction 说:
The Surefire Report Plugin parses the generated
TEST-*.xml
files under${basedir}/target/surefire-reports
...
因此,如果您将 soapui-maven-plugin 更改为:
<outputFolder>${basedir}/target/surefire-reports</outputFolder>
应该可以。
还有 additional instructions 如何更改 maven-surefire-report-plugin 的默认位置。
示例 pom.xml,其中还使用 mvn site 命令创建了报告。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.smartbear.samples</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven 2 SoapUI Sample</name>
<url>http://maven.apache.org</url>
<pluginRepositories>
<pluginRepository>
<id>smartbear-sweden-plugin-repository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>5.3.0</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectFile>globalweather-soapui-project.xml</projectFile>
<junitReport>true</junitReport>
<outputFolder>${basedir}/target/surefire-reports</outputFolder>
<printReport>true</printReport>
<exportAll>true</exportAll>
<globalProperties>
<value>ENV=DEV</value>
</globalProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>2.1</version>
<configuration>
<outputDirectory>${basedir}/target/surefire-reports</outputDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
</project>