gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 11:23:48 25 4
gpt4 key购买 nike

我已经在我的 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com