java - SoapUI、Maven、Surefire 和 Jenkins 集成

标签 java maven jenkins maven-surefire-plugin

我正在尝试使用 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 时,则不会显示任何内容。

希望这有帮助。

enter image description here

关于java - SoapUI、Maven、Surefire 和 Jenkins 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43828215/

相关文章:

jenkins - 如何读取 Jenkins Web Hook post 请求正文?

java - 对于这种情况是否需要 Java 到 PHP 桥接器?

java - cucumber 在 Intellij Idea 中无法工作 : Seems like IDE is not reading plug-ins

java - 在 javaFX 中切换场景

java - 根据maven配置文件排除嵌入式服务器

xml - 如何将 maven pom.xml 转换为 build.gradle 文件?

java - 如何使用 Maven 签署多个 JNLP 应用程序

javascript - 从 Javascript 调用 jar 中定义的 java 类

windows - 在同一台 Windows 机器上安装多个 Jenkins 实例会导致问题

jenkins - 如何让 Jenkins 使用从节点上设置的现有环境变量?