【问题标题】:How to configure maven postman plugin to send email only if test fails如何配置 maven postman 插件仅在测试失败时发送电子邮件
【发布时间】:2017-06-17 01:40:56
【问题描述】:

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

也试过了,但没用 - http://doc.fortysix.ch/maven/maven-postman-plugin/surefire-mail.html

这是我的 pom.xml sn-p -

<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>

【问题讨论】:

  • 你写过测试用例吗?

标签: java maven email plugins postman


【解决方案1】:

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

<testFailureIgnore>true</testFailureIgnore>

Refer here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-11-10
    • 2022-08-20
    • 1970-01-01
    • 2012-10-09
    • 1970-01-01
    • 1970-01-01
    • 2017-12-08
    • 1970-01-01
    相关资源
    最近更新 更多