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


评论关闭
IT源码网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!