java - 如何配置maven postman插件仅在测试失败时发送电子邮件

标签 java maven email plugins postman

我已经在我的 pom.xml 中配置了 maven postman 插件,并且总是可以接收电子邮件,测试通过或失败。我只想在测试失败时收到电子邮件。尝试了很多方法但还没有成功。看看下面的 groovyCondition。有人可以帮忙吗?

也尝试过这个,但不起作用 - http://doc.fortysix.ch/maven/maven-postman-plugin/surefire-mail.html

这是我的 pom.xml 片段 -

<plugin>
        <groupId>ch.fortysix</groupId>
        <artifactId>maven-postman-plugin</artifactId>
        <configuration>
            <skip>false</skip>
            <from>akash1234</from>
            <failonerror>true</failonerror>
            <mailhost>host1234</mailhost>
            <mailport>007</mailport>
            <receivers>
                <receiver>akashxxxxxx</receiver>
            </receivers>
        </configuration>
        <executions>
          <execution>
            <id>send surefire notification</id>
            <phase>site</phase>
            <goals>
                <goal>surefire-mail</goal>
            </goals>
            <configuration>
                <subject>Test Surefire</subject>
                <groovyCondition><![CDATA[failures > 0]]></groovyCondition>
                <receivers>
                   <receiver>akashxxxxxx</receiver>
                </receivers>
            </configuration>
          </execution>
        </executions>
      </plugin>
</build>        

<reporting>
   <plugins>
      <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.4.3</version>
      </plugin> 
<plugins>
</reporting>

最佳答案

在 maven-surefire-plugin 的配置部分添加这些行:

<testFailureIgnore>true</testFailureIgnore>

Refer here

关于java - 如何配置maven postman插件仅在测试失败时发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44599997/

相关文章:

smtp - 如何确定我的邮件服务器配置是否正确?

java - 如何在用户关闭应用程序 JFrame 之后、程序退出之前直接保存一些对象?

java - Java 目录 API 客户端库的 Maven 依赖项是什么?

bootstrap-maven 类的 css 类覆盖

php - MAMP PRO PHP 邮件 - Gmail

validation - 帐户用户名的最佳做法?

java - 在java中使用正则表达式。将绳子绕在管道上

java - 如何截断 java 整数以适应/扩展到给定的字节数?

java - 我正在尝试通过实现异步任务在 android (java) 中流式传输 chatgpt api 的响应(逐字),但我收到错误

java - 如何获取我的Java应用程序所需的传递依赖项列表?