【问题标题】:How can I set Jenkins to display "Build failure" on failure of test cases?如何设置 Jenkins 在测试用例失败时显示“构建失败”?
【发布时间】:2014-04-02 21:34:53
【问题描述】:

在测试用例失败时,它会显示[ERROR] There are test failures.,但最后还会显示FINISHED:Build Success,在构建历史记录中显示为蓝色。 在失败和成功时,它还会使用我的 POM.xml 中的依赖项发送邮件,即

<plugin>
                <groupId>ch.fortysix</groupId>
                <artifactId>maven-postman-plugin</artifactId>
                <executions>
                    <execution>
                        <id>send a mail</id>
                        <phase>test</phase>
                        <goals>
                            <goal>send-mail</goal>
                        </goals>
                        <inherited>false</inherited>
                        <configuration>
                            <from>my email address</from>
                            <subject>Test Results</subject>
                            <failonerror>true</failonerror>
                            <mailhost></mailhost>
                            <receivers>

                                <receiver>recipientsemail</receiver>


                            </receivers>
                            <htmlMessageFile>
            /workspace/target/surefire-reports/emailable-report.html
                            </htmlMessageFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

这个插件在&lt;build&gt; 标签内。
我想发送成功和失败的电子邮件,但它也应该在 Jenkins 中失败。我想我需要改变一些东西Jenkins,因为我已经在 pom.xml 中指定了&lt;failonerror&gt;true&lt;/failonerror&gt;。请让我知道我缺少什么。
我正在使用 Jenkins 1.466.2(Debian/Ubuntu 发行版)。

【问题讨论】:

    标签: maven jenkins


    【解决方案1】:

    jenkins performance plugin 允许您创建测试报告并定义不稳定或失败构建的阈值。

    【讨论】:

      【解决方案2】:

      您还可以使用 Text-finder 后操作插件,在控制台日志中搜索适合您的任何 RegEx,然后将构建降级为 FAILED。至于发送电子邮件,请使用 Jenkins 的 Email Ext 插件。它有大量用于不同触发器的选项,包括测试失败UNSTABLE

      【讨论】:

        猜你喜欢
        • 2013-05-23
        • 1970-01-01
        • 2019-10-17
        • 2016-01-04
        • 2015-04-25
        • 2017-04-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多