我正在尝试使用 maven、surefire 和 jenkins 运行 SoapUI xml 项目文件。 对于 maven 和 jenkins 来说一切都很好,构建完成后,Junit 报告显示在 jenkins 中(包含非常基本的信息 - 测试用例名称和状态)
我想使用 Surefire 来显示报告和日志(我可以在 target/surfire-report/中看到日志文件的所有 *.xml 和 *.txt)。 如何配置jenkins显示surefire报告和日志文件?
这是我的 pom.xml 文件
<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>
<configuration>
<projectFile>${basedir}/src/test/java/Test-API-soapui-project.xml</projectFile>
<outputFolder>${basedir}/target/surefire-reports/</outputFolder>
<junitReport>true</junitReport>
<exportwAll>true</exportwAll>
<printReport>true</printReport>
</configuration>
<executions>
<execution>
<id>soapUI</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui</artifactId>
<version>5.3.0</version>
<exclusions>
<exclusion>
<groupId>javafx</groupId>
<artifactId>jfxrt</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.20</version>
</plugin>
</plugins>
</build>
最佳答案
不确定您是否解决了这个问题,但我就是这样做的。
在 Jenkins 中为您的项目构建添加发布 junit 测试报告结果的构建后操作。 将测试报告 XML 设置为指向您在其中看到正在写入的报告的 target/surefire-reports 目录。 在下面的示例中,我在 config 目录中存在的子模块“dev”中运行测试。 您会知道它何时是正确的,因为如果 Jenkins 找不到报告 xml,它将显示一条红色错误消息,而当它在您告诉他们的位置找到报告 xml 时,则不会显示任何内容。
希望这有帮助。
关于java - SoapUI、Maven、Surefire 和 Jenkins 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43828215/