如何配置maven postman插件,以便在测试失败时发送电子邮件

时间:2017-06-17 01:40:57

标签: 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>

1 个答案:

答案 0 :(得分:0)

在maven-surefire-plugin的配置部分添加以下行:

<testFailureIgnore>true</testFailureIgnore>

Refer here